UIView
extension UIView
-
A convenience method that adds a UITapGestureRecognizer to a view, while also passing default values to its convenience initializer.
Declaration
Swift
@discardableResult public func addTapGesture(tapsRequired: Int = 1, touchesRequired: Int = 1, handler: @escaping (_ gesture: UITapGestureRecognizer) -> Void) -> UITapGestureRecognizerParameters
tapsRequiredDefaults UITapGestureRecognizer’s
numberOfTapsRequiredproperty valuetouchesRequiredDefaults UITapGestureRecognizer’s
numberOfTouchesRequiredproperty valuehandlerThe closure that is called when the gesture is recognized
Return Value
The gesture that was created so that it can be used to daisy chain other customizations
-
A convenience method that adds a UILongPressGestureRecognizer to a view, while also passing default values to its convenience initializer.
Declaration
Swift
@discardableResult public func addLongPressGesture(tapsRequired: Int = 0, touchesRequired: Int = 1, minDuration: CFTimeInterval = 0.5, allowableMovement: CGFloat = 10, handler: @escaping (_ gesture: UILongPressGestureRecognizer) -> Void) -> UILongPressGestureRecognizerParameters
tapsRequiredDefaults UILongPressGestureRecognizer’s
numberOfTapsRequiredproperty valuetouchesRequiredDefaults UILongPressGestureRecognizer’s
numberOfTouchesRequiredproperty valueminDurationDefaults UILongPressGestureRecognizer’s
minimumPressDurationproperty valueallowableMovementDefaults UILongPressGestureRecognizer’s
allowableMovementproperty valuehandlerThe closure that is called when the gesture is recognized
Return Value
The gesture that was created so that it can be used to daisy chain other customizations
-
A convenience method that adds a UIPinchGestureRecognizer to a view, while also passing default values to its convenience initializer.
Declaration
Swift
@discardableResult public func addPinchGesture(handler: @escaping (_ gesture: UIPinchGestureRecognizer) -> Void) -> UIPinchGestureRecognizerParameters
handlerThe closure that is called when the gesture is recognized
Return Value
The gesture that was created so that it can be used to daisy chain other customizations
-
A convenience method that adds a UISwipeGestureRecognizer to a view, while also passing default values to its convenience initializer.
Declaration
Swift
@discardableResult public func addSwipeGesture(direction: UISwipeGestureRecognizer.Direction = .right, touchesRequired: Int = 1, handler: @escaping (_ gesture: UISwipeGestureRecognizer) -> Void) -> UISwipeGestureRecognizerParameters
directionDefaults UISwipeGestureRecognizer’s
directionproperty valuetouchesRequiredDefaults UISwipeGestureRecognizer’s
numberOfTouchesRequiredproperty valuehandlerThe closure that is called when the gesture is recognized
Return Value
The gesture that was created so that it can be used to daisy chain other customizations
-
A convenience method that adds a UIRotationGestureRecognizer to a view, while also passing default values to its convenience initializer.
Declaration
Swift
@discardableResult public func addRotationGesture(handler: @escaping (_ gesture: UIRotationGestureRecognizer) -> Void) -> UIRotationGestureRecognizerParameters
handlerThe closure that is called when the gesture is recognized
Return Value
The gesture that was created so that it can be used to daisy chain other customizations
-
A convenience method that adds a UIPanGestureRecognizer to a view, while also passing default values to its convenience initializer.
Declaration
Swift
@discardableResult public func addPanGesture(minTouches: Int = 1, maxTouches: Int = .max, handler: @escaping (_ gesture: UIPanGestureRecognizer) -> Void) -> UIPanGestureRecognizerParameters
minTouchesDefaults UIPanGestureRecognizer’s
minimumNumberOfTouchesproperty valuemaxTouchesDefaults UIPanGestureRecognizer’s
maximumNumberOfTouchesproperty valuehandlerThe closure that is called when the gesture is recognized
Return Value
The gesture that was created so that it can be used to daisy chain other customizations
-
A convenience method that adds a UIScreenEdgePanGestureRecognizer to a view, while also passing default values to its convenience initializer.
Declaration
Swift
@discardableResult public func addScreenEdgePanGesture(edges: UIRectEdge = .all, handler: @escaping (_ gesture: UIScreenEdgePanGestureRecognizer) -> Void) -> UIScreenEdgePanGestureRecognizerParameters
edgesDefaults UIScreenEdgePanGestureRecognizer’s
edgesproperty valuehandlerThe closure that is called when the gesture is recognized
Return Value
The gesture that was created so that it can be used to daisy chain other customizations
View on GitHub
UIView Extension Reference