Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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()
}
@ollieatkinson
Copy link
Author

ollieatkinson commented May 2, 2017

// Setup your test...

        viewController.viewWillTransition(to: .zero, with: makeTestViewControllerTransitionCoordinator())

// Validate the output...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment