Generic Structure


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


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


A simultaneous gesture is a container-event handler that evaluates its two child gestures at the same time. Its value is a struct with two optional values, each representing the phases of one of the two gestures.


Creating a Simultaneous Gesture

init(First, Second)

Creates a gesture with two gestures that can receive updates or succeed independently of each other.

var first: First

The first of two gestures that can happen simultaneously.

var second: Second

The second of two gestures that can happen simultaneously.

typealias SimultaneousGesture.Body

A type that represents the simultaneous gesture and its behavior.

Performing the Gesture

struct SimultaneousGesture.Value

The value of a simultaneous gesture that indicates which of its two gestures receives events.

Composing Gestures

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

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