Group Group Group Group Group Group Group Group Group Forums

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

Great tutorial for Custom View Controller Transitions!

Just want to point this particular line of codes:
// ... present(herbDetails, animated: true, completion: nil) herbDetails.transitioningDelegate = self // Add this line

Make sure to set the delegate first before you present the view controller or else the transition delegate won’t be triggered.


I am trying to create an animation with the fromView as well. My toView has a clear background and so I want to be able to see the fromView behind it when the transition is complete.

switchAcc.transitioningDelegate = self
switchAcc.modalPresentationStyle = .overFullScreen
self.present(switchAcc, animated: true, completion: nil)

To achieve this we must set the modal style to overcurrentcontext, overfullscreen, or custom.

The only problem is that now in the PopAnimator the app will crash when trying to get a reference to the from view:

if let fromView = transitionContext.view(forKey: .from) {
//This is never executed

Is this a swift bug?

in func positionListItems(), set listView contentSize height as zero is because UIScrollView set AutoLayout height constraint or some other reason?

I noticed that the project doesn’t handle orientation correctly. The parent controller isn’t responding to orientation when the detail view is orienting. Anyway to resolve this issue?

Hi admin, can you make some tutorials on AVFoundation in swift 3 to show how to make a photo slideshow app that shows each photo in different animation styles and save that photo slide show as any video format like mp4, mkv or any. I have made a project that adds music and plays photo slide show and save that show as movie that can be played in computers but photos don’t have animations. Can you please show us how to do that? Thanks

could any one please explain why we use below code in viewcontroller.swift file, how it helps to place scroll view in right position , because I commented this line out and its not taking the horizontal padding. Thanks.
// listView.viewWithTag(0)?.tag = 1000

if listView.subviews.count < herbs.count {
listView.viewWithTag(0)?.tag = 1000 //prevent confusion when looking up images