PanGesture
public struct PanGesture : Gesture
Wrapper of UIPanGestureRecognizer A discrete gesture recognizer that interprets panning gestures.
PanGesture(minimumNumberOfTouches: 1, maximumNumberOfTouches: 10) { pan in
// pan action
}
.onBegan { (pan, location, velocity, direction) in
// on began action
}
.onMoved { (pan, location, velocity) in
// on moved acton
}
.onEnded { (pan, location, velocity) in
// on ended action
}
.onCancelled { (pan, location, velocity) in
// on cancelled action
}
.enableDragView(true)
-
Undocumented
See moreDeclaration
Swift
public enum PanGestureDirection
-
Undocumented
Declaration
Swift
public typealias ObserverBeganAction = (_ gesture: UIPanGestureRecognizer, _ location: CGPoint, _ velocity: CGPoint, _ direction: PanGestureDirection?) -> Void
-
Undocumented
Declaration
Swift
public typealias ObserverAction = (_ gesture: UIPanGestureRecognizer, _ location: CGPoint, _ velocity: CGPoint) -> Void
-
The action to handle the gesture recognized by the receiver.
Declaration
Swift
public var action: (UIGestureRecognizer) -> Void { get }
-
The gesture behind the PanGesture.
Declaration
Swift
public var gesture: UIGestureRecognizer { get }
-
Initializer
Declaration
Swift
public init(minimumNumberOfTouches:Int = 1, maximumNumberOfTouches:Int = Int(INT_MAX), onPanGesture:@escaping (_ gesture: UIGestureRecognizer) -> Void)
Parameters
minimumNumberOfTouches
The minimum number of fingers that can touch the view for gesture recognition.
maximumNumberOfTouches
The maximum number of fingers that can touch the view for gesture recognition.
onPanGesture
The action to handle the gesture recognized by the receiver.
-
Sets the action to handle the gesture recognized by the receiver when state is began.
Declaration
Swift
@discardableResult public func onBegan(_ action: @escaping ObserverBeganAction) -> PanGesture
Parameters
action
The action to handle the gesture recognized by the receiver when state is began.
Return Value
Self
-
Sets the action to handle the gesture recognized by the receiver when state is changed.
Declaration
Swift
@discardableResult public func onMoved(_ action: @escaping ObserverAction) -> PanGesture
Parameters
action
The action to handle the gesture recognized by the receiver when state is changed.
Return Value
Self
-
Sets the action to handle the gesture recognized by the receiver when state is ended.
Declaration
Swift
@discardableResult public func onEnded(_ action: @escaping ObserverAction) -> PanGesture
Parameters
action
The action to handle the gesture recognized by the receiver when state is ended.
Return Value
Self
-
Sets the action to handle the gesture recognized by the receiver when state is cancelled.
Declaration
Swift
@discardableResult public func onCancelled(_ action: @escaping ObserverAction) -> PanGesture
Parameters
action
The action to handle the gesture recognized by the receiver when state is cancelled.
Return Value
Self
-
Enable drag the view which adds the gesture when the gesture recognized by the receiver.
Declaration
Swift
@discardableResult public func enableDragView(_ value: Bool) -> PanGesture
Parameters
value
true if you want to drag the view when the gesture recognized by the receiver.
Return Value
Self