To solve your problem there is a library Hero . With it, you can add beautiful animations to an iOS application, including when creating a new UIViewController in a UINavigationController .
I will not describe the process of installing this library, I will just say that you can install it through CocoaPods. To work with Hero, add the following line to the beginning of the code file:
import Hero
Then in the place where you are going to show the new UIViewController , set up the default animation:
Hero.shared.defaultAnimation = HeroDefaultAnimationType.cover(direction: .right)
And also report that your UINavigationController is going to use the Hero library:
self.navigationController?.hero.isEnabled = true
Now even when using the standard pushViewController function, you will see the expected result on the screen:
self.navigationController?.pushViewController(vc, animated: true)
Something like this will happen on the screen:
