Group Group Group Group Group Group Group Group Group

iOS Animation Tutorial: Custom View Controller Presentation Transitions |

Learn how to create custom view controller presentation transitions and spice up the navigation of your iOS apps!

This is a companion discussion topic for the original entry at

hi there,
Great tutorial.
One small issue is this. sometimes the animation takes time(2 - 4 seconds). Sometimes, the animation does not go into full screen. I have to tap again. Can you tell me what can be the cause?
i tested on iphone x simulator and iphone 6 device.

Thanks for the article.

This is due to tableView didSelectRowAt:

Adding following there would solve this problem
tableView.deselectRow(at: indexPath, animated: false )

But you’ve to manually maintain indexPathForSelectedRow

1 Like

hello, thanks for tutorial.
i want to use self.present, i don’t like segue.
how can i do make this ?

@fbrancati Can you please help with this when you get a chance? Thank you - much appreciated! :]

@emirb Storyboards are just another way of doing UI. You can avoid the performSegue call and create the UIViewController directly and using the “present” API instead. You can do that by using XIBs or by code. Anyway, I suggest you use Storyboards and segues, you can achieve the same things just easier.

Great article, but I get a crash on the line:
Fatal error: Unexpectedly found nil while unwrapping an Optional value
I’m running XCode 11 with an IOS 13 simulator.

Yes you’re right, the animator crashes because it tried to unwrap a view which is not available anymore.

The property toView which you used during the presentation actually becomes a fromView during dismissal.

It was used earlier in the tutorial but is actually not needed at the end because we’re using recipeView instead.

To fix it you can simply remove the property toView and incorporate it into recipeView like so:

let containerView = transitionContext.containerView

let recipeView = presenting ? transitionContext.view(forKey: .to)! : transitionContext.view(forKey: .from)!

Note how the faulty line has been removed in the middle an added in recipeView

Doing this will trigger another error a bit further in the method as it’s trying to add toView as subview, which is not possible because we juste removed it. Lucky for us we incorporated it in recipeView so you can add that one instead:


Tadaa, the whole shebang should work again!

Enjoy your new animation!

@valera Thank you for sharing your solution - much appreciated! :]