暂无描述

PresentExtension.swift 1.2KB

123456789101112131415161718192021222324252627282930313233343536
  1. //
  2. // PresentExtension.swift
  3. // PaiaiUIKit
  4. //
  5. // Created by FFIB on 2019/1/25.
  6. // Copyright © 2019 FFIB. All rights reserved.
  7. //
  8. import UIKit
  9. public extension GestureRecognizerDelegate where Self: UIViewController & PresentAnimatorDelegate {
  10. func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer,
  11. shouldReceive touch: UITouch) -> Bool {
  12. if touch.view == view {
  13. return true
  14. }
  15. return false
  16. }
  17. }
  18. public extension ViewControllerTransitioningDelegate where Self: UIViewController & PresentAnimatorDelegate {
  19. func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
  20. let transitioning = PresentDisappearAnimatedTransitioning(animator: animator)
  21. transitioning.delegate = self
  22. return transitioning
  23. }
  24. func animationController(forPresented presented: UIViewController,
  25. presenting: UIViewController, source: UIViewController)
  26. -> UIViewControllerAnimatedTransitioning? {
  27. let transitioning = PresentAppearAnimatedTransitioning(animator: animator)
  28. transitioning.delegate = self
  29. return transitioning
  30. }
  31. }