coordinateSpace
TypeScriptget coordinateSpace(): _SwiftUICore_CoordinateSpaceSwift declarationvar coordinateSpace: CoordinateSpaceThe coordinate space in which to receive location values.
struct · iOS 16.0+ · SDK 27.1
nonisolated struct SpatialTapGestureA gesture that recognizes one or more taps and reports their location. To recognize a tap gesture on a view, create and configure the gesture, and then add it to the view using the ``View/gesture(_:including:)`` modifier. The following code adds a tap gesture to a ``Circle`` that toggles the color of the circle based on the tap location: struct TapGestureView: View { @State private var location: CGPoint = .zero var tap: some Gesture { SpatialTapGesture() .onEnded { event in self.location = event.location } } var body: some View { Circle() .fill(self.location.y > 50 ? Color.blue : Color.red) .frame(width: 100, height: 100, alignment: .center) .gesture(tap) } }
get coordinateSpace(): _SwiftUICore_CoordinateSpaceSwift declarationvar coordinateSpace: CoordinateSpaceThe coordinate space in which to receive location values.
set coordinateSpace(value: _SwiftUICore_CoordinateSpace)Swift declarationvar coordinateSpace: CoordinateSpaceThe coordinate space in which to receive location values.
static init(count?: number, coordinateSpace?: _SwiftUICore_CoordinateSpace): SpatialTapGestureSwift declarationnonisolated init(count: Int = 1, coordinateSpace: CoordinateSpace = .local)Creates a tap gesture with the number of required taps and the coordinate space of the gesture's location. - Parameters: - count: The required number of taps to complete the tap gesture. - coordinateSpace: The coordinate space of the tap gesture's location.
get count(): numberSwift declarationvar count: IntThe required number of tap events.
set count(value: number)Swift declarationvar count: IntThe required number of tap events.
2 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
SpatialTapGesture.init(count:coordinateSpace:)
This parameter hides a concrete Swift type.
SpatialTapGesture.init(count:coordinateSpace:inputKinds:)
This parameter hides a concrete Swift type.