Reputation: 39
I just started coding with iOS 13 and am having issues with view controller functions. Previous to iOS 13 I had a view controller presented using this function
func presentDetail(_ viewControllerToPresent: UIViewController){
let transition = CATransition()
transition.duration = 0.22
transition.type = kCATransitionPush
transition.subtype = kCATransitionFromRight
self.view.window?.layer.add(transition, forKey: kCATransition)
present(viewControllerToPresent, animated: false, completion: nil)
}
And when dismissed, viewDidAppear in the root view controller would trigger. Now in iOS 13 it seems like the VC is built on top of the root VC, and when dismissed it does NOT trigger viewDidAppear in the root VC. Is there a different function I have to use or do I have to completely change my approach? root VC viewDidAppear currently triggers when viewDidLoad and when user switches to it from tab bar, any advice would be great, thank you!
Upvotes: 2
Views: 1995
Reputation: 1051
The default presentation style, which is the card style, will not trigger viewDidAppear
when you dismiss the view controller.
You'll most likely have to switch to a different modalPresentationStyle
that will trigger it. One of the presentation style's that does trigger it for example is .fullScreen
So for example, for viewControllerToPresent
you'd want to set it's presentation style to
viewControllerToPresent.modalPresentationStyle = .fullScreen
before you present it
Upvotes: 3