mathewsanders/Interactive-Transition-Swift-Tutorial

Transition fix for iOS 13

Opened this issue · 0 comments

UIApplication.sharedApplication().keyWindow.addSubview(screens.to.view)

Probably this issue exists in previous iOS releases, but it's clearly visible what's wrong only on iOS 13 as native presentation transition now keeps presentingViewController visible under presentedViewController.

The problem: if you do custom transition and upon completing transition animation for dismissal call addSubview to keyWindow - it seems to work correct.
However, if you then try to present any other view controller using native presentation behavior - animation will broke: presentingViewController will not animate to "moving back" like it suppose to animate in iOS 13.
In iOS 13 they have put UITransitionView in between UIWindow and our controller. So presentingViewController's superview is not keyWindow. Therefore putting it on keyWindow upon completion of dismiss transition is not correct.

The safest way would be to retain superview of presentingViewController before presenting, and then call superview.addSubview when dismissing.