Demo.swift
ContentView.swift
App.swift
import SwiftUI
struct DoubleTapDemo: View {
@State private var count = 0
var body: some View {
VStack(spacing: 12) {
Text("Double taps: \(count)")
RoundedRectangle(cornerRadius: 8)
.fill(.blue.opacity(0.15))
.frame(width: 160, height: 80)
.overlay(Text("Double tap me"))
.gesture(TapGesture(count: 2).onEnded { count += 1 })
}
.padding()
}
}
import SwiftUI
struct ContentView: View {
var body: some View { DoubleTapDemo() }
}
import SwiftUI
@main
struct MyApp: App {
var body: some Scene {
WindowGroup { ContentView() }
}
}