Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhenry committed Sep 29, 2020
1 parent 746fdee commit b0e613a
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions Sources/ImageViewerTransitionPresentationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,27 @@ extension ImageViewerTransitionPresentationAnimator: UIViewControllerAnimatedTra
completed: @escaping((Bool) -> Void)) {

guard
let transitionVC = controller as? ImageViewerTransitionViewControllerConvertible
let transitionVC = controller as? ImageViewerTransitionViewControllerConvertible,
let sourceView = transitionVC.sourceView
else { return }

sourceView.alpha = 0.0
controller.view.alpha = 0.0

let sourceView = transitionVC.sourceView
transitionView.addSubview(controller.view)
transitionVC.targetView?.alpha = 0.0

let dummyImageView = createDummyImageView(
frame: sourceView?.frameRelativeToWindow() ?? .zero,
image: sourceView?.image)
frame: sourceView.frameRelativeToWindow(),
image: sourceView.image)
dummyImageView.contentMode = .scaleAspectFit
transitionView.addSubview(dummyImageView)

sourceView?.alpha = 0.0

transitionView.addSubview(controller.view)
controller.view.alpha = 0.0

UIView.animate(withDuration: duration, animations: {
dummyImageView.contentMode = .scaleAspectFit
dummyImageView.frame = UIScreen.main.bounds
controller.view.alpha = 1.0
}) { finished in
transitionVC.targetView?.alpha = 1.0
dummyImageView.removeFromSuperview()
completed(finished)
}
Expand Down

0 comments on commit b0e613a

Please sign in to comment.