Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // MARK: - Pan
- typealias HandlePanGesture = MSAlertController
- extension HandlePanGesture: UIGestureRecognizerDelegate {
- @objc func handlePan(sender: UIPanGestureRecognizer) {
- switch sender.state {
- case .began:
- startLocation = sender.location(in: view)
- if let direction = sender.direction {
- if animator?.currentState == .closed {
- if direction == .left {
- animator?.setAnimation(to: .open)
- }
- } else {
- if direction == .right {
- animator?.setAnimation(to: .closed)
- }
- }
- }
- animator?.trackProgress()
- case .changed:
- currentLocation = sender.location(in: view)
- animator?.setFractionComplete(fraction: sideGap/self.maxdx)
- case .ended:
- animator?.reverseAnimation(sidegap: sideGap)
- animator?.completeAnimation()
- break
- default:
- break
- }
- sender.setTranslation(CGPoint.zero, in: view)
- }
- }
Add Comment
Please, Sign In to add comment