Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. ollieatkinson created this gist May 2, 2017.
    68 changes: 68 additions & 0 deletions TestViewControllerTransitionCoordinator.swift
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,68 @@
    func makeTestViewControllerTransitionCoordinator() -> UIViewControllerTransitionCoordinator {

    class ViewControllerTransitionCoordinator: NSObject, UIViewControllerTransitionCoordinatorContext, UIViewControllerTransitionCoordinator {

    public var isAnimated: Bool { return false }

    public var presentationStyle: UIModalPresentationStyle { return .formSheet }

    public var initiallyInteractive: Bool { return false }

    @available(iOS 10.0, *)
    public var isInterruptible: Bool { return false }

    public var isInteractive: Bool { return false }

    public var isCancelled: Bool { return false }

    public var transitionDuration: TimeInterval { return 1 }

    public var percentComplete: CGFloat { return 0 }

    public var completionVelocity: CGFloat { return 1 }

    public var completionCurve: UIViewAnimationCurve { return .easeIn }

    @available(iOS 2.0, *)
    public func viewController(forKey key: UITransitionContextViewControllerKey) -> UIViewController? {
    return nil
    }

    @available(iOS 8.0, *)
    public func view(forKey key: UITransitionContextViewKey) -> UIView? {
    return nil
    }

    @available(iOS 2.0, *)
    public var containerView: UIView { return UIView() }

    @available(iOS 8.0, *)
    public var targetTransform: CGAffineTransform { return .identity }

    @available(iOS 10.0, *)
    public func notifyWhenInteractionChanges(_ handler: @escaping (UIViewControllerTransitionCoordinatorContext) -> Void) {

    }

    @available(iOS, introduced: 7.0, deprecated: 10.0, message: "Use notifyWhenInteractionChangesUsingBlock")
    public func notifyWhenInteractionEnds(_ handler: @escaping (UIViewControllerTransitionCoordinatorContext) -> Void) {

    }

    func animate(alongsideTransition animation: ((UIViewControllerTransitionCoordinatorContext) -> Void)?, completion: ((UIViewControllerTransitionCoordinatorContext) -> Void)?) -> Bool {
    return true
    }

    func animateAlongsideTransition(
    in view: UIView?,
    animation: ((UIViewControllerTransitionCoordinatorContext) -> Void)?,
    completion: ((UIViewControllerTransitionCoordinatorContext) -> Void)?
    ) -> Bool {
    return true
    }

    }

    return ViewControllerTransitionCoordinator()

    }