Skip to content

Commit

Permalink
Merge pull request #107 from michaelhenry/issues/issue_106
Browse files Browse the repository at this point in the history
Issues/issue 106
  • Loading branch information
michaelhenry authored Sep 29, 2020
2 parents 5d2b8e1 + b0e613a commit ad8810e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Binary file removed .DS_Store
Binary file not shown.
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 ad8810e

Please sign in to comment.