Generic Structure


A type-erased gesture.


@frozen struct AnyGesture<Value>


Implementing a Custom Gesture


Creates an instance from another gesture.

typealias AnyGesture.Body

A type that represents the gesture and its behavior.

Performing the Gesture

func onChanged((Value) -> Void) -> _ChangedGesture<AnyGesture<Value>>

Adds an action to perform when the gesture’s value changes.

func onEnded((Value) -> Void) -> _EndedGesture<AnyGesture<Value>>

Adds an action to perform when the gesture ends.

Composing Gestures

func simultaneously<Other>(with: Other) -> SimultaneousGesture<AnyGesture<Value>, Other>

Combines a gesture with another gesture to create a new gesture that recognizes both gestures at the same time.

func sequenced<Other>(before: Other) -> SequenceGesture<AnyGesture<Value>, Other>

Sequences a gesture with another one to create a new gesture, which results in the second gesture only receiving events after the first gesture succeeds.

func exclusively<Other>(before: Other) -> ExclusiveGesture<AnyGesture<Value>, Other>

Combines two gestures exclusively to create a new gesture where only one gesture succeeds, giving precedence to the first gesture.

Adding Modifier Keys to a Gesture

Transforming a Gesture

func map<T>((Value) -> T) -> _MapGesture<AnyGesture<Value>, T>

Returns a gesture that’s the result of mapping the given closure over the gesture.


Conforms To

See Also

Custom Gestures

protocol Gesture

An instance that matches a sequence of events to a gesture, and returns a stream of values for each of its states.