Created
August 19, 2021 20:03
-
-
Save emin-grbo/490449980d795d4b2b0e2254cfcdac9f to your computer and use it in GitHub Desktop.
Watch Haptics preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct ContentViewWatch: View { | |
@State var selection = 0 | |
var body: some View { | |
VStack { | |
Picker("Haptic Type", selection: $selection) { | |
Text("notification").tag(0) | |
Text("directionUp").tag(1) | |
Text("directionDown").tag(2) | |
Text("success").tag(3) | |
Text("failure").tag(4) | |
Text("retry").tag(5) | |
Text("start").tag(6) | |
Text("stop").tag(7) | |
Text("click").tag(8) | |
} | |
} | |
.onTapGesture { | |
WKInterfaceDevice.current().play(WKHapticType(rawValue: selection)!) | |
} | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentViewWatch() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment