@@ -77,26 +77,27 @@ extension ImageViewerTransitionPresentationAnimator: UIViewControllerAnimatedTra
77
77
completed: @escaping ( ( Bool ) -> Void ) ) {
78
78
79
79
guard
80
- let transitionVC = controller as? ImageViewerTransitionViewControllerConvertible
80
+ let transitionVC = controller as? ImageViewerTransitionViewControllerConvertible ,
81
+ let sourceView = transitionVC. sourceView
81
82
else { return }
83
+
84
+ sourceView. alpha = 0.0
85
+ controller. view. alpha = 0.0
82
86
83
- let sourceView = transitionVC. sourceView
87
+ transitionView. addSubview ( controller. view)
88
+ transitionVC. targetView? . alpha = 0.0
84
89
85
90
let dummyImageView = createDummyImageView (
86
- frame: sourceView? . frameRelativeToWindow ( ) ?? . zero,
87
- image: sourceView? . image)
91
+ frame: sourceView. frameRelativeToWindow ( ) ,
92
+ image: sourceView. image)
93
+ dummyImageView. contentMode = . scaleAspectFit
88
94
transitionView. addSubview ( dummyImageView)
89
95
90
- sourceView? . alpha = 0.0
91
-
92
- transitionView. addSubview ( controller. view)
93
- controller. view. alpha = 0.0
94
-
95
96
UIView . animate ( withDuration: duration, animations: {
96
- dummyImageView. contentMode = . scaleAspectFit
97
97
dummyImageView. frame = UIScreen . main. bounds
98
98
controller. view. alpha = 1.0
99
99
} ) { finished in
100
+ transitionVC. targetView? . alpha = 1.0
100
101
dummyImageView. removeFromSuperview ( )
101
102
completed ( finished)
102
103
}
0 commit comments