@@ -7,22 +7,27 @@ final class NavigationTransitionDelegate: NSObject, UINavigationControllerDelega
7
7
var transition : AnyNavigationTransition
8
8
private weak var baseDelegate : UINavigationControllerDelegate ?
9
9
var interactionController : UIPercentDrivenInteractiveTransition ?
10
- private var initialAreAnimationsEnabled = UIView . areAnimationsEnabled
10
+ private var initialAreAnimationsEnabled : Bool ?
11
11
12
12
init ( transition: AnyNavigationTransition , baseDelegate: UINavigationControllerDelegate ? ) {
13
13
self . transition = transition
14
14
self . baseDelegate = baseDelegate
15
15
}
16
16
17
17
func navigationController( _ navigationController: UINavigationController , willShow viewController: UIViewController , animated: Bool ) {
18
- initialAreAnimationsEnabled = UIView . areAnimationsEnabled
19
- UIView . setAnimationsEnabled ( transition. animation != nil )
18
+ if navigationController. transitionCoordinator != nil {
19
+ self . initialAreAnimationsEnabled = UIView . areAnimationsEnabled
20
+ UIView . setAnimationsEnabled ( transition. animation != nil )
21
+ }
20
22
baseDelegate? . navigationController ? ( navigationController, willShow: viewController, animated: animated)
21
23
}
22
24
23
25
func navigationController( _ navigationController: UINavigationController , didShow viewController: UIViewController , animated: Bool ) {
24
26
baseDelegate? . navigationController ? ( navigationController, didShow: viewController, animated: animated)
25
- UIView . setAnimationsEnabled ( initialAreAnimationsEnabled)
27
+ if let initialAreAnimationsEnabled {
28
+ UIView . setAnimationsEnabled ( initialAreAnimationsEnabled)
29
+ self . initialAreAnimationsEnabled = nil
30
+ }
26
31
}
27
32
28
33
func navigationController( _ navigationController: UINavigationController , interactionControllerFor animationController: UIViewControllerAnimatedTransitioning ) -> UIViewControllerInteractiveTransitioning ? {
0 commit comments