Guest User

Untitled

a guest
Apr 23rd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. // MARK: - Pan
  2. typealias HandlePanGesture = MSAlertController
  3. extension HandlePanGesture: UIGestureRecognizerDelegate {
  4. @objc func handlePan(sender: UIPanGestureRecognizer) {
  5. switch sender.state {
  6. case .began:
  7. startLocation = sender.location(in: view)
  8. if let direction = sender.direction {
  9. if animator?.currentState == .closed {
  10. if direction == .left {
  11. animator?.setAnimation(to: .open)
  12. }
  13. } else {
  14. if direction == .right {
  15. animator?.setAnimation(to: .closed)
  16. }
  17. }
  18. }
  19. animator?.trackProgress()
  20. case .changed:
  21. currentLocation = sender.location(in: view)
  22. animator?.setFractionComplete(fraction: sideGap/self.maxdx)
  23. case .ended:
  24. animator?.reverseAnimation(sidegap: sideGap)
  25. animator?.completeAnimation()
  26. break
  27. default:
  28. break
  29. }
  30. sender.setTranslation(CGPoint.zero, in: view)
  31. }
  32. }
Add Comment
Please, Sign In to add comment