Generic Structure


A gesture that consists of two gestures where only one of them can succeed.


@frozen struct ExclusiveGesture<First, Second> where First : Gesture, Second : Gesture


The ExclusiveGesture gives presedence to its first gesture.


Creating an Exclusive Gesture

init(First, Second)

Creates a gesture from two gestures where only one of them succeeds.

var first: First

The first of two gestures.

var second: Second

The second of two gestures.

typealias ExclusiveGesture.Body

A type that represents the exclusive gesture and its behavior.

Performing the Gesture

enum ExclusiveGesture.Value

The value of an exclusive gesture that indicates which of two gestures succeeded.

Composing Gestures

func simultaneously<Other>(with: Other) -> SimultaneousGesture<ExclusiveGesture<First, Second>, 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<ExclusiveGesture<First, Second>, 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<ExclusiveGesture<First, Second>, 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<ExclusiveGesture<First, Second>, T>

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


Conforms To

See Also

Combined Gestures

Composing SwiftUI Gestures

Combine gestures to create complex interactions.

struct SequenceGesture

A gesture that’s a sequence of two gestures.

struct SimultaneousGesture

A gesture containing two gestures that can happen at the same time with neither of them preceeding the other.