<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/onTapGesture(count:coordinateSpace:inputKinds:perform:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE12onTapGesture5count15coordinateSpace10inputKinds7performQrSi_qd__AA0f5InputK0VySo7CGPointVctAA010CoordinateI8ProtocolRd__lF"
  },
  "title" : "onTapGesture(count:coordinateSpace:inputKinds:perform:)"
}
-->

# onTapGesture(count:coordinateSpace:inputKinds:perform:)

Adds an action to perform when this view recognizes a tap gesture,
and provides the action with the location of the interaction.

```
nonisolated func onTapGesture(count: Int = 1, coordinateSpace: some CoordinateSpaceProtocol = .local, inputKinds: GestureInputKinds = .all, perform action: @escaping (CGPoint) -> Void) -> some View
```

## Parameters

`count`

The number of taps or clicks required to trigger the
action closure provided in `action`.

`coordinateSpace`

The coordinate space in which to receive
location values.

`inputKinds`

A set of input kinds that this gesture recognizes.
If not specified, the gesture will recognize all applicable input
kinds that a person can use to perform it.

`action`

The action to perform. This closure receives an input
that indicates where the interaction occurred.

---

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)