The title pretty much says it all. I have a ViewController
which I present
like this:
let communityVC = self.storyboard?.instantiateViewController(withIdentifier: "CommunityVC") as! CommunityViewController
communityVC.hero.modalAnimationType = .zoomSlide(direction: .right)
let addButtonHeroID = "addWishButtonID"
self.addButton.heroID = addButtonHeroID
communityVC.homeButton.heroID = addButtonHeroID
self.present(communityVC, animated: true, completion: nil)
The thing is that insice comunityVC
I would like to push
another ViewController
. Is that somehow possible? I couldnt really find a Swift
solution that is working.
You need to present communityVC
after embedding the UINavigationController
, then you can push the view controller inside communityVC
, so you can push ViewController by using navigationController?.pushViewController(vc, animated: true)
from communityV
let communityVC = self.storyboard?.instantiateViewController(withIdentifier: "CommunityVC") as! CommunityViewController
let navController = UINavigationController(rootViewController: communityVC)
communityVC.hero.modalAnimationType = .zoomSlide(direction: .right)
let addButtonHeroID = "addWishButtonID"
self.addButton.heroID = addButtonHeroID
communityVC.homeButton.heroID = addButtonHeroID
self.present(navController, animated: true, completion: nil)