Re-add custom LargeImageViewController presentation/dismissal animations

This commit is contained in:
Shadowfacts 2019-06-14 00:00:53 -07:00
parent 8a45837918
commit 730308df3f
Signed by untrusted user: shadowfacts
GPG Key ID: 83FB3304046BADA4
2 changed files with 20 additions and 21 deletions

View File

@ -10,32 +10,29 @@ import UIKit
extension UIViewController: UIViewControllerTransitioningDelegate {
public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
if presented is LargeImageViewController {
return LargeImageExpandAnimationController()
} else {
return nil
// if presented is LargeImageViewController {
// return LargeImageExpandAnimationController()
// } else {
// return nil
// }
}
}
public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
if let dismissed = dismissed as? LargeImageViewController {
return LargeImageShrinkAnimationController(interactionController: dismissed.dismissInteractionController)
} else {
return nil
// if let dismissed = dismissed as? LargeImageViewController {
// return LargeImageShrinkAnimationController(interactionController: dismissed.dismissInteractionController)
// } else {
// return nil
// }
}
}
public func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
if let animator = animator as? LargeImageShrinkAnimationController,
let interactionController = animator.interactionController,
interactionController.inProgress {
return interactionController
} else {
return nil
// if let animator = animator as? LargeImageShrinkAnimationController,
// let interactionController = animator.interactionController,
// interactionController.inProgress {
//
// return interactionController
// } else {
// return nil
// }
}
}
}

View File

@ -108,6 +108,7 @@ extension TuskerNavigationDelegate where Self: UIViewController {
let sourceCornerRadius = sourceView.layer.cornerRadius
let vc = LargeImageViewController(image: image, description: description, sourceFrame: sourceFrame, sourceCornerRadius: sourceCornerRadius)
vc.transitioningDelegate = self
vc.modalPresentationStyle = .fullScreen
return vc
}
@ -125,6 +126,7 @@ extension TuskerNavigationDelegate where Self: UIViewController {
let vc = LargeImageViewController(image: UIImage(data: gifData)!, description: description, sourceFrame: sourceFrame, sourceCornerRadius: sourceCornerRadius)
vc.transitioningDelegate = self
vc.gifData = gifData
vc.modalPresentationStyle = .fullScreen
return vc
}