Presenting Controller is nil in custom transitioning delegate: “nil while unwrapping Optional”

Have a custom UIViewControllerTransitioningDelegate which, when its presentationController(forPresented, presenting, source)  method is called after a View Controller calls present, the presenting parameter is nil, which my method wasn’t expecting. Well, turns out, according to Swift docs…

This parameter may also be nil to indicate that the presenting view controller will be determined later.

Well, what a helpful parameter. So we need to handle this case, just in case the presenting view controller needs to be determined later for some reason.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s