@@ -77,26 +77,27 @@ extension ImageViewerTransitionPresentationAnimator: UIViewControllerAnimatedTra
7777 completed: @escaping ( ( Bool ) -> Void ) ) {
7878
7979 guard
80- let transitionVC = controller as? ImageViewerTransitionViewControllerConvertible
80+ let transitionVC = controller as? ImageViewerTransitionViewControllerConvertible ,
81+ let sourceView = transitionVC. sourceView
8182 else { return }
83+
84+ sourceView. alpha = 0.0
85+ controller. view. alpha = 0.0
8286
83- let sourceView = transitionVC. sourceView
87+ transitionView. addSubview ( controller. view)
88+ transitionVC. targetView? . alpha = 0.0
8489
8590 let dummyImageView = createDummyImageView (
86- frame: sourceView? . frameRelativeToWindow ( ) ?? . zero,
87- image: sourceView? . image)
91+ frame: sourceView. frameRelativeToWindow ( ) ,
92+ image: sourceView. image)
93+ dummyImageView. contentMode = . scaleAspectFit
8894 transitionView. addSubview ( dummyImageView)
8995
90- sourceView? . alpha = 0.0
91-
92- transitionView. addSubview ( controller. view)
93- controller. view. alpha = 0.0
94-
9596 UIView . animate ( withDuration: duration, animations: {
96- dummyImageView. contentMode = . scaleAspectFit
9797 dummyImageView. frame = UIScreen . main. bounds
9898 controller. view. alpha = 1.0
9999 } ) { finished in
100+ transitionVC. targetView? . alpha = 1.0
100101 dummyImageView. removeFromSuperview ( )
101102 completed ( finished)
102103 }
0 commit comments