Slide 1

Slide 1 text

Practical WatchKit Development @claushoefele

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

WatchKit App WatchKit Extension iOS App WatchKit App vs Extension

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

class TripDetailInterfaceController: WKInterfaceController { @IBOutlet private weak var map: WKInterfaceMap! override func awakeWithContext(context: AnyObject?) { super.awakeWithContext(context) ... } override func willActivate() { super.willActivate() ... } }

Slide 7

Slide 7 text

map.addAnnotation(coordinate, withPinColor: .Red) let coordinateRegion = MKCoordinateRegionMakeWithDistance[...] map.setRegion(coordinateRegion)

Slide 8

Slide 8 text

Tables

Slide 9

Slide 9 text

Paging

Slide 10

Slide 10 text

Interactive Notifications

Slide 11

Slide 11 text

Hides when loading

Slide 12

Slide 12 text

Bezel WatchSim

Slide 13

Slide 13 text

• Storyboards • WKInterfaceController • Optimizations • Tools User Interface

Slide 14

Slide 14 text

WatchKit App WatchKit Extension Requesting Data

Slide 15

Slide 15 text

WatchKit App WatchKit Extension iOS App Requesting Data

Slide 16

Slide 16 text

private func callParentApp() { let userInfo = ["input": "data"] WKInterfaceController.openParentApplication(userInfo) { replyInfo, error in println("reply \(replyInfo)") } }

Slide 17

Slide 17 text

private func callParentApp() { let userInfo = ["input": "data"] WKInterfaceController.openParentApplication(userInfo) { replyInfo, error in println("reply \(replyInfo)") } } func application(application: UIApplication!, handleWatchKitExtensionRequest userInfo: [NSObject : AnyObject]!, reply: (([NSObject : AnyObject]!) -> Void)!)

Slide 18

Slide 18 text

Handoff

Slide 19

Slide 19 text

WatchKit Extension iOS App Sharing Data

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

let defaults = NSUserDefaults(suiteName: "group.com.claushoefele.T")! func updateObjectForKey(key: String, item: T) { let data = NSKeyedArchiver.archivedDataWithRootObject(item) defaults.setObject(data, forKey: key) }

Slide 22

Slide 22 text

WatchKit Extension iOS App Signalling

Slide 23

Slide 23 text

func sendDarwinNotification(identifier: String) { let darwinNotificationCenter = CFNotificationCenterGetDarwinNotifyCenter() CFNotificationCenterPostNotification(darwinNotificationCenter, identifier, nil, nil, 1); } CFNotificationCenterAddObserver

Slide 24

Slide 24 text

Data Sync

Slide 25

Slide 25 text

• Execute in background • Handoff • Share data • Signal changes Handling data

Slide 26

Slide 26 text

“A WatchKit app complements your iOS app; it does not replace it.” –Apple Watch HIG

Slide 27

Slide 27 text

“Anything that could show the user a progress spinner (however briefly) is a failure on my part.” –David Smith

Slide 28

Slide 28 text

“Does a wearable mean data intrudes even more into your life, or do the constraints (screen size etc) act as a filter to reduce overload?” –Bendict Evans

Slide 29

Slide 29 text

Practical WatchKit Development @claushoefele