Search code examples
iosswiftxcodeuinavigationcontrollerios14

pushViewController & popViewController animation no longer functioning in iOS 14


For some reason this code:

self.navigationController?.pushViewController(vc, animated: true)

Is behaving the exact same way as:

self.navigationController?.pushViewController(vc, animated: false)

The behavior is a non-animated push. I am not sure why the animation parameter is no longer functioning. It worked properly in iOS 13. Is this a bug?

Upon further research, I also noticed that in viewWillAppear, ViewWillDisappear, and ViewDidAppear that the animated property is false. Overriding the functions with:

super.viewWillAppear(true)

does not make any difference.

For further context, I am using a UIViewControllerRepresentable that displays a UITabBarController that contains a NavigationController inside of it. The view in the UINavigationController, and all of the pushed views, are where I am experiencing this issue.


Solution

  • Fixed my problem!

    Turns out that in my UITabBarController I had this line of code in my viewDidAppear function:

    super.viewWillAppear(animated)
    

    instead of viewDidAppear! As a result, the nested UINavigationController had animations off. Unsure why this worked in iOS 13, but it shouldn't have!

    Key takeaway: remember to properly override your viewWillAppear and viewDidAppear functions!

    Going to keep this in here in case someone else runs into this issue.