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

developing apps with watchkit
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Developing Apps With WatchKit

Adam Shaw

Kabuki Vision

A Whirlwind Tour

@KabukiVision

Dressed NoteMaster Journaling

slide-2
SLIDE 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
slide-3
SLIDE 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

slide-4
SLIDE 4

WatchKit Extensions

  • WatchKit App


  • Glance (optional)


  • Notification (optional)
slide-5
SLIDE 5

Architecture

WatchKit App

Storyboard Resources

WatchKit Extension

Code! Resources

iPhone App

Code Resources

WatchKit WatchKit

slide-6
SLIDE 6

Architecture

WatchKit Extension

Code Resources

WatchKit

iPhone App

Code Resources

Shared Data

Limited Communication

slide-7
SLIDE 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)

slide-8
SLIDE 8

Things you CANNOT do

Hardware sensors (heart rate, step counter, accelerometer, etc)

slide-9
SLIDE 9

Things you CANNOT do

Wireless Communications

slide-10
SLIDE 10

Things you CANNOT do

Core Animation CAN animate as sequence of images (like an animated GIF)

slide-11
SLIDE 11

Things you CANNOT do

Multi-touch gestures Swiping, dragging, etc.

slide-12
SLIDE 12

Things you CANNOT do

Direct access to speaker or microphone

slide-13
SLIDE 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
slide-14
SLIDE 14

UI created using storyboards in Xcode’s Interface Builder

User Interface

Storyboards

slide-15
SLIDE 15

User Interface

Interface Elements

  • Text labels, buttons, images
  • Switches, sliders, separators,

maps

  • “Text” input (via voice)
  • Groups
  • Tables
slide-16
SLIDE 16
  • 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

User Interface

Interface Elements

slide-17
SLIDE 17
  • 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

User Interface

Interface Layout

slide-18
SLIDE 18

User Interface

Interface Navigation

Hierarchical Page-based Modal Can’t mix and match hierarchical and page-based (at the same level)

slide-19
SLIDE 19

User Interface

Images

WatchKit App

Installed Images

WatchKit Extension

Code! Cached Images

slide-20
SLIDE 20

Sharing Data

WatchKit extension & iOS app

WatchKit Extension

Sandbox

iPhone App

Shared Data

Sandbox App Group XYZ App Group XYZ

slide-21
SLIDE 21

Communication

WatchKit extension & iOS app

WatchKit Extension

Sandbox

iPhone App

Sandbox

  • penParentApplication:reply

application:handleWatchKitExtensionRequest:reply:

slide-22
SLIDE 22

Communication

WatchKit extension & iOS app

WatchKit Extension

Sandbox

iPhone App

Sandbox

Darwin Notifications (MMWormhole)

slide-23
SLIDE 23

Networking

WatchKit Extension

Sandbox

iPhone App

Sandbox

  • penParentApplication:reply

application:handleWatchKitExtensionRequest:reply:

???

Shared Data

slide-24
SLIDE 24

Gotchas

  • Unpredictable and merciless lifecycle
  • WatchKit extension can and will be killed at

any time without warning

  • User puts down wrist
  • Screen timeout
slide-25
SLIDE 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
slide-26
SLIDE 26

Gotchas

  • Permissions (contacts, images,

location etc.)

  • Only main iOS app can trigger

these

slide-27
SLIDE 27

THANKS!

Adam Shaw

Kabuki Vision

@KabukiVision

Dressed NoteMaster Journaling