Hi!
I'm trying to push view controller using hero and it is amazing, my problem comes when i want to dismiss the view using hero_dismissViewController(), it just doesn't work. What I'm trying to do is the following:
VC[A] -> VC[B] Works
VC[B{backButton}] -> VC[A]
Here's the code:
VC[A] -> VC[B]
let nextController = storyboard?.instantiateViewController(withIdentifier: "EstablishmentDetailsViewController") as! EstablishmentDetailsViewController
nextController.establishment = establishment
// the following two lines configures the animation. default is .auto
Hero.shared.setDefaultAnimationForNextTransition(.zoom)
Hero.shared.setContainerColorForNextTransition(.white)
hero_replaceViewController(with: nextController)
VC[B{backButton}] -> VC[A]
@IBAction func backButtonPressed(_ sender: UIButton) {
hero_dismissViewController()
}
Thanks in advance
Because you used hero_replaceViewController, your VC[A] doesn't exist any more. Just use present(VCB, animated: true, completion:nil) to present your VC[B] should solve your problem.
Cleaning Old Issues. Feel free to reopen.
Most helpful comment
Because you used
hero_replaceViewController, your VC[A] doesn't exist any more. Just usepresent(VCB, animated: true, completion:nil)to present your VC[B] should solve your problem.