Skip to content

Commit b0e613a

Browse files
committed
1 parent 746fdee commit b0e613a

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

Sources/ImageViewerTransitionPresentationManager.swift

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)