Generic Structure

SequenceGesture

A gesture that’s a sequence of two gestures.

Declaration

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

Overview

Read Composing SwiftUI Gestures to learn how you can create a sequence of two gestures.

Topics

Creating a Sequence Gesture

init(First, Second)

Creates a sequence gesture with two gestures.

var first: First

The first gesture in a sequence of two gestures.

var second: Second

The second gesture in a sequence of two gestures.

typealias SequenceGesture.Body

A type that represents the sequence gesture and its behavior.

Performing the Gesture

enum SequenceGesture.Value

The value of a sequence gesture that helps to detect whether the first gesture succeeded, so the second gesture can start.

Composing Gestures

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

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

Relationships

Conforms To

See Also

Combined Gestures

Composing SwiftUI Gestures

Combine gestures to create complex interactions.

struct SimultaneousGesture

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

struct ExclusiveGesture

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