---
title: "onTapGesture(count:coordinateSpace:inputKinds:perform:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/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.

## Declaration

```swift
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.

## See Also

### Recognizing tap gestures

- [onTapGesture(count:perform:)](swiftui/view/ontapgesture(count:perform:).md)
- [onTapGesture(count:coordinateSpace:perform:)](swiftui/view/ontapgesture(count:coordinatespace:perform:).md)
- [TapGesture](swiftui/tapgesture.md)
- [SpatialTapGesture](swiftui/spatialtapgesture.md)
