Tusker/Tusker/Extensions/UIViewController+Delegates....

37 lines
1.4 KiB
Swift
Raw Normal View History

2018-09-02 20:59:20 +00:00
//
// UIViewController+StatusTableViewCellDelegate.swift
// Tusker
//
// Created by Shadowfacts on 8/27/18.
// Copyright © 2018 Shadowfacts. All rights reserved.
//
import UIKit
extension UIViewController: UIViewControllerTransitioningDelegate {
public func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
if let presented = presented as? LargeImageAnimatableViewController,
presented.animationImage != nil {
return LargeImageExpandAnimationController()
}
2019-06-15 00:23:03 +00:00
return nil
2018-09-02 20:59:20 +00:00
}
2019-06-15 00:23:03 +00:00
2018-09-02 20:59:20 +00:00
public func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
if let dismissed = dismissed as? LargeImageAnimatableViewController,
dismissed.animationImage != nil {
return LargeImageShrinkAnimationController(interactionController: dismissed.dismissInteractionController)
}
2019-06-15 00:23:03 +00:00
return nil
2018-09-02 20:59:20 +00:00
}
2019-06-15 00:23:03 +00:00
2018-09-02 20:59:20 +00:00
public func interactionControllerForDismissal(using animator: UIViewControllerAnimatedTransitioning) -> UIViewControllerInteractiveTransitioning? {
if let animator = animator as? LargeImageShrinkAnimationController,
let interactionController = animator.interactionController,
interactionController.inProgress {
return interactionController
}
2019-06-15 00:23:03 +00:00
return nil
2018-09-02 20:59:20 +00:00
}
}