35
The Other WatchKit Alexsander Akers · @a2 NSLondon · 25/09/14

The Other WatchKit

Embed Size (px)

DESCRIPTION

A WatchKit you can use right now!

Citation preview

Page 1: The Other WatchKit

The Other WatchKitAlexsander Akers · @a2NSLondon · 25/09/14

Page 2: The Other WatchKit

Availableearly 2015

Page 3: The Other WatchKit

Availableearly 2015

Page 4: The Other WatchKit
Page 5: The Other WatchKit

Apple madewatches cool.

Page 6: The Other WatchKit

Remember this?

xkcd 1420 "Watches" by Randall Munroe.

Page 7: The Other WatchKit

Let’s get ticking!

Page 8: The Other WatchKit

I can haz SDK?Local

$ brew install pebble-sdk

http://developer.getpebble.com/sdk/

Online

CloudPebble http://cloudpebble.net

Page 9: The Other WatchKit

Project Creation$ pebble new-project --javascript NSLondon$ tree NSLondon.├── appinfo.json├── resources├── src│   ├── NSLondon.c│   └── js│   └── pebble-js-app.js└── wscript

Page 10: The Other WatchKit

Project AnatomyNSLondon.c

#include <pebble.h>

static Window *window;

Page 11: The Other WatchKit

Project AnatomyNSLondon.c

static void init(void) { window = window_create(); window_stack_push(window, true);}

static void deinit(void) { window_destroy(window);}

Page 12: The Other WatchKit

Project AnatomyNSLondon.c

int main(void) { init(); app_event_loop(); deinit();}

Page 13: The Other WatchKit

Components• Window ≈ UIViewController

• WindowStack ≈ UINavigationController

• Layer ≈ UIView

Page 14: The Other WatchKit

ComponentsWindow

As we saw before, window_create() and window_destroy() are used for window creation and destruction.

You get access to the root layer with window_get_root_layer().

Page 15: The Other WatchKit

ComponentsWindowStack

Push with window_stack_push().Pop with window_stack_pop().

Page 16: The Other WatchKit

ComponentsActionBarLayer

Page 17: The Other WatchKit

Components(Rot)BitmapLayer

Page 18: The Other WatchKit

GCompOp

Page 19: The Other WatchKit

ComponentsScrollLayer

Page 20: The Other WatchKit

ComponentsSimpleMenuLayer

Page 21: The Other WatchKit

ComponentsMenuLayer

Page 22: The Other WatchKit

ComponentsTextLayer

Page 23: The Other WatchKit

ComponentsInverterLayer

Page 24: The Other WatchKit

Other UI features• Vibration

• Backlight

• Click handling

• Animations

Page 25: The Other WatchKit

Graphics• Circles

• Rects

• Rounded rects

• Paths

• Fills & strokes

• Text drawing/sizing

Page 26: The Other WatchKit

AppMessageTalk with JS / SDK

Page 27: The Other WatchKit

TimersCall function after delay

Page 28: The Other WatchKit

StorageThe poor man's NSUserDefaults

Page 29: The Other WatchKit

Event ServicesAccelerometer

Page 30: The Other WatchKit

Event ServicesApp Focus

Page 31: The Other WatchKit

Event ServicesBattery

Page 32: The Other WatchKit

Event ServicesBluetooth Connection

Page 33: The Other WatchKit

Event ServicesCompass / Magnetometer

Page 34: The Other WatchKit

Event ServicesTick Timer

Page 35: The Other WatchKit

The Other WatchKitAlexsander Akers · @a2NSLondon · 25/09/14