init(count: Int)
Creates a tap gesture with the number of required taps.
あるタップゼスチャをこの必要とされるタップ数で作成します。
var count: Int
The required number of tap events.
必要とされるタップイベントの数。
Availability 有効性
Technology
struct TapGesture
To recognize a tap gesture on a view, create and configure the gesture, and then add it to the view using the gesture(_:
modifier. The following code adds a tap gesture to a Circle
that toggles the color of the circle.
struct TapGestureView: View {
var tapped = false
var tap: some Gesture {
TapGesture(count: 1)
.onEnded { _ in self.tapped = !self.tapped }
}
var body: some View {
Circle()
.fill(self.tapped ? Color.blue : Color.red)
.frame(width: 100, height: 100, alignment: .center)
.gesture(tap)
}
}
init(count: Int)
var count: Int
typealias Body
Self
.
ジェスチャの型、Self
のボディを表しています。
typealias Value
struct LongPressGesture
struct DragGesture
struct MagnificationGesture
struct RotationGesture