WatchKit Bootcamp

40
@benmorrow

Transcript of WatchKit Bootcamp

@benmorrow

bootcamp concepts

demos modify

session 1 user input with mic 

getting the current location networking, API

session 2  images on the cache

drawing & saving images animating images

session 3 sharing data with app groups

NSNotificationCenter

session 4 glances

notifications

session 1 user input with mic 

getting the current location networking, API

challenge from the watch,

get the temperature for a location specified by the user

and display it

challenge milestones hook up button to get input

send input to parent app geocode the input

send location to weather api reply back to watch with temp

session 2  images on the cache

drawing & saving images animating images

images setImage(_:)  

setImageData(_:)  

setImageNamed(_:)  

device-side cache cachedImages  

addCachedImage(_:name:)  

addCachedImageWithData(_:name:)  

removeCachedImageWithName(_:)  

removeAllCachedImages()  

considerations 1. Only cache an image if it

isn’t already cached 2. If full, evict one at a time

until new image is successful

challenge edit the

fitness-animation-starter to make the arcs animate

session 3 sharing data with app groups

NSNotificationCenter

NSUserDefaults persist data

NSData  NSString  NSNumber     NSDate  NSArray  

NSDictionary  

app groups shared containers

that allow communication between apps

NSNotificationCenter watch for

changes to data and react when there is one

challenge save the temperature

update both iOS app and WatchKit app

session 4 glances

notifications

Glances

Notification

challenge create a Glance

for the temperature

@benmorrow

WatchKit

relea

sed

hack

athon

nov

http://hackathon.watch

marfeb

iOS 8.2

watch

classes WKInterfaceController  

WKInterfaceObject  

WKInterfaceDevice

methods contextForSegueWithIdentifier:  

awakeWithContext:  

setText:,  setHidden:,  setAlpha:,  setWidth:  

openParentApplication(_:reply:)

Hierarchical Page-based

limitations hardware sensors

animation stand-alone native apps

bit.ly/wktips