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) -> UITapGestureRecognizer
Parameters
tapsRequired
Defaults UITapGestureRecognizer’s
numberOfTapsRequired
property valuetouchesRequired
Defaults UITapGestureRecognizer’s
numberOfTouchesRequired
property valuehandler
The 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) -> UILongPressGestureRecognizer
Parameters
tapsRequired
Defaults UILongPressGestureRecognizer’s
numberOfTapsRequired
property valuetouchesRequired
Defaults UILongPressGestureRecognizer’s
numberOfTouchesRequired
property valueminDuration
Defaults UILongPressGestureRecognizer’s
minimumPressDuration
property valueallowableMovement
Defaults UILongPressGestureRecognizer’s
allowableMovement
property valuehandler
The 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) -> UIPinchGestureRecognizer
Parameters
handler
The 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) -> UISwipeGestureRecognizer
Parameters
direction
Defaults UISwipeGestureRecognizer’s
direction
property valuetouchesRequired
Defaults UISwipeGestureRecognizer’s
numberOfTouchesRequired
property valuehandler
The 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) -> UIRotationGestureRecognizer
Parameters
handler
The 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) -> UIPanGestureRecognizer
Parameters
minTouches
Defaults UIPanGestureRecognizer’s
minimumNumberOfTouches
property valuemaxTouches
Defaults UIPanGestureRecognizer’s
maximumNumberOfTouches
property valuehandler
The 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) -> UIScreenEdgePanGestureRecognizer
Parameters
edges
Defaults UIScreenEdgePanGestureRecognizer’s
edges
property valuehandler
The 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