developing apps with watchkit
play

Developing Apps With WatchKit A Whirlwind Tour Adam Shaw Kabuki - PowerPoint PPT Presentation

Developing Apps With WatchKit A Whirlwind Tour Adam Shaw Kabuki Vision @KabukiVision Journaling NoteMaster Dressed WatchKit SDK for building apps for Apple Watch Similar, but different from iOS app development Very limited


  1. Developing Apps With WatchKit A Whirlwind Tour Adam Shaw Kabuki Vision @KabukiVision Journaling NoteMaster Dressed

  2. WatchKit • SDK for building apps for Apple Watch • Similar, but different from iOS app development • Very limited • Can’t build true “native” apps • Need • Xcode (Mac) • Apple Watch • iPhone

  3. WatchKit Extensions WatchKit app is an extension to an iPhone app. “Starting later next year, developers will be able to create fully native apps for Apple Watch.” — Apple, Nov 2014

  4. 
 
 WatchKit Extensions • WatchKit App 
 • Glance (optional) 
 • Notification (optional)

  5. Architecture WatchKit WatchKit WatchKit App WatchKit Extension Code! Storyboard Resources Resources iPhone App Code Resources

  6. Architecture WatchKit WatchKit Extension Code Resources Limited Shared Communication Data iPhone App Code Resources

  7. Architecture • WatchKit app distributed as part of iOS app • WatchKit code in “WatchKit extension” • None of your code runs on the watch! • All of your WatchKit extension code runs on iPhone (in separate background process from main app)

  8. Things you CANNOT do Hardware sensors (heart rate, step counter, accelerometer, etc)

  9. Things you CANNOT do Wireless Communications

  10. Things you CANNOT do Core Animation CAN animate as sequence of images (like an animated GIF)

  11. Things you CANNOT do Multi-touch gestures Swiping, dragging, etc.

  12. Things you CANNOT do Direct access to speaker or microphone

  13. What CAN you do? • Basically: • Put stuff on the screen • Respond to simple button taps • Use iPhone features (GPS, networking, etc.) • Change stuff on the screen

  14. User Interface Storyboards UI created using storyboards in Xcode’s Interface Builder

  15. User Interface Interface Elements • Text labels, buttons, images • Switches, sliders, separators, maps • “Text” input (via voice) • Groups • Tables

  16. User Interface Interface Elements • Everything must be defined in the storyboard • No dynamic creation of interface elements in code (mostly) • Most attributes (color, image, text, etc) can be controlled in code • “Hidden” attribute can be used to effectively add/remove elements from the interface • Table “rows” are the only elements that can be dynamically added/removed in code

  17. User Interface Interface Layout • All layout defined in storyboards • No auto layout, no explicit positioning • Relative positioning - interface objects laid out vertically or horizontally • Content expands downward, allowing vertical scrolling • Two different watch sizes

  18. User Interface Interface Navigation Hierarchical Page-based Modal Can’t mix and match hierarchical and page-based (at the same level)

  19. User Interface Images WatchKit App WatchKit Extension Installed Images Code! Cached Images

  20. Sharing Data WatchKit extension & iOS app WatchKit Extension App Group XYZ Sandbox Shared Data iPhone App App Group XYZ Sandbox

  21. Communication WatchKit extension & iOS app WatchKit Extension Sandbox openParentApplication:reply application:handleWatchKitExtensionRequest:reply: iPhone App Sandbox

  22. Communication WatchKit extension & iOS app WatchKit Extension Sandbox Darwin Notifications (MMWormhole) iPhone App Sandbox

  23. Networking WatchKit Extension Sandbox ??? openParentApplication:reply Shared Data application:handleWatchKitExtensionRequest:reply: iPhone App Sandbox

  24. Gotchas • Unpredictable and merciless lifecycle • WatchKit extension can and will be killed at any time without warning • User puts down wrist • Screen timeout

  25. Gotchas • UI Performance • Communication speed and latency between iPhone and Apple Watch • Dynamically generated images sent over to watch from iPhone • Watch not fast at loading images, period • Reacting to button taps are a two-way trip

  26. Gotchas • Permissions (contacts, images, location etc.) • Only main iOS app can trigger these

  27. THANKS! Adam Shaw Kabuki Vision @KabukiVision Journaling NoteMaster Dressed

Recommend


More recommend