1 //  Copyright (c) 2018, Applidium. All rights reserved
2 //  UIPanGesture+Utils.swift
3 //  Pods
4 //
5 //  Created by Gaétan Zanella on 28/11/2018.
6 //
7 
8 import UIKit
9 
10 extension UIPanGestureRecognizer {
11 
12     enum VerticalDirection {
13         case up
14         case down
15         case none
16     }
17 
18     var yDirection: VerticalDirection {
19         let yVelocity = velocity(in: nil).y
20         if yVelocity == 0 {
21             return .none
22         }
23         if yVelocity < 0 {
24             return .up
25         }
26         return .down
27     }
28 }
29