Reputation: 125
How do you make a haptic play on the apple watch when you press a button using Objective-C and Xcode.
Upvotes: 2
Views: 1783
Reputation: 987
at least in Xcode 11 in objective-c you'd do (Xcode 11)
[[WKInterfaceDevice currentDevice] playHaptic: WKHapticTypeSuccess];
Upvotes: 3
Reputation: 276
Objective-C:
[[WKInterfaceDevice currentDevice] playHaptic:WKHapticType.Success]
Swift:
WKInterfaceDevice.currentDevice().playHaptic(.Success)
Types of Haptic you can play:
WKHapticType.Notification,
WKHapticType.DirectionUp,
WKHapticType.DirectionDown,
WKHapticType.Success,
WKHapticType.Failure,
WKHapticType.Retry,
WKHapticType.Start,
WKHapticType.Stop,
WKHapticType.Click
Upvotes: 7