<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/simultaneousGesture(_:isEnabled:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE19simultaneousGesture_9isEnabledQrqd___SbtAA0E0Rd__lF"
  },
  "title" : "simultaneousGesture(_:isEnabled:)"
}
-->

# simultaneousGesture(_:isEnabled:)

Attaches a gesture to the view to process simultaneously with gestures
defined by the view.

```
@export(implementation) nonisolated func simultaneousGesture<T>(_ gesture: T, isEnabled: Bool) -> some View where T : Gesture
```

## Parameters

`gesture`

A gesture to attach to the view.

`isEnabled`

Whether the added gesture is enabled.

## Discussion

Use this method when you need to define and process  a view specific
gesture simultaneously with the same priority as the
view’s existing gestures. The example below defines a custom gesture
that prints a message to the console and attaches it to the view’s
[`VStack`](/documentation/SwiftUI/VStack). Inside the [`VStack`](/documentation/SwiftUI/VStack) is a red heart [`Image`](/documentation/SwiftUI/Image) defines its
own [`TapGesture`](/documentation/SwiftUI/TapGesture) handler that also prints a message to the console
and a blue rectangle with no custom gesture handlers.

You can also use the `isEnabled` parameter to conditionally disable
the gesture.

Tapping or clicking the “heart” image sends two messages to the
console: one for the image’s tap gesture handler, and the other from a
custom gesture handler attached to the enclosing vertical stack.
Tapping or clicking on the blue rectangle results only in the single
message to the console from the tap recognizer attached to the
[`VStack`](/documentation/SwiftUI/VStack):

```
struct SimultaneousGestureExample: View {
    @State private var message = "Message"
    var isGestureEnabled: Bool
    let newGesture = TapGesture().onEnded {
        print("Gesture on VStack.")
    }

    var body: some View {
        VStack(spacing:25) {
            Image(systemName: "heart.fill")
                .resizable()
                .frame(width: 75, height: 75)
                .padding()
                .foregroundColor(.red)
                .onTapGesture {
                    print("Gesture on image.")
                }
            Rectangle()
                .fill(Color.blue)
        }
        .simultaneousGesture(
            newGesture, isEnabled: isGestureEnabled)
        .frame(width: 200, height: 200)
        .border(Color.purple)
    }
}
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)