13

I'm interested in building an app for watchOS 2 using haptic feedback. Currently I do not have the Apple Watch, but I have access to the Apple Developer Program. I've tried looking at the watchOS Developer Library and watchOS 2 Release Notes.

I do not see any mention of how to access the Taptic engine programmatically or what it is capable of in the current watchOS 2.

How can I access the Taptic engine programmatically or understand what the new Taptic API is capable of doing?

Seyed Parsa Neshaei
  • 3,470
  • 18
  • 30
Alex Stone
  • 46,408
  • 55
  • 231
  • 407

1 Answers1

19

You can find the Apple API documentations for the haptic feedback here:

https://developer.apple.com/documentation/watchkit/wkinterfacedevice

You will find a function named

- playHaptic:

So you need to call this function to play the related haptic. This can be done with the following code:

Swift:

WKInterfaceDevice.currentDevice().playHaptic(<#WKHapticType#>)

Objective-C:

[[WKInterfaceDevice currentDevice] playHaptic:<#WKHapticType#>]

Be aware though, for now these feedbacks are unavailable to test on the simulator (because these haptic feedbacks are produced by the new Taptic Engine which is not accessible from any other device than a real Apple Watch), but you can test it on a real device (with watchOS 2 beta installed) if you have one.

These are the types of haptic you can play:

   WKHapticType.Notification,
   WKHapticType.DirectionUp,
   WKHapticType.DirectionDown,
   WKHapticType.Success,
   WKHapticType.Failure,
   WKHapticType.Retry,
   WKHapticType.Start,
   WKHapticType.Stop,
   WKHapticType.Click 
Cœur
  • 37,241
  • 25
  • 195
  • 267
Philip
  • 2,287
  • 1
  • 22
  • 37
  • Thanks, from this documentation it appears that devs still cannot record and play back their own taptic feedback sequences, instead they are limited to pre-programmed sequences. This means I can't make the app that I want :( – Alex Stone Jul 08 '15 at 19:32
  • 2
    Can't you mix these haptic feedbacks to implement your app? – Seyed Parsa Neshaei Jul 09 '15 at 14:35
  • 2
    The original Apple Watch videos made it seem as if a person can send a completely freeform series of taps from one apple watch to another. This made me believe that taps can be recorded and replayed in a certain pattern. It seems that the current API does not allow that. – Alex Stone Jul 10 '15 at 17:24
  • Does the feedback include sound as well or do we need to include that separately? – Ace Green Aug 02 '15 at 21:13
  • @Philip Does the sound work with headphones and/or music playing? – Ace Green Dec 19 '15 at 19:50