mDevcon 2015: See the time on your wrist

mDevcon 2015: See the time on your wrist

For a long time, people were only able to see the time on their (smart)phones”. Apple came with a brilliant invention that allows us to see the time on our wrist! Or perhaps that’s just what the youngest generation will think a few years from now.

Of course the new Apple Watch does allow us to do much more than just see the time. In this session we will see how to use WatchKit, how to integrate it with existing apps, create Glances and Watch specific notifications.

- TN2408 - https://developer.apple.com/library/ios/technotes/tn2408/_index.html
- Devforums confirming Darwin notifications is ok - https://devforums.apple.com/thread/256667?tstart=0
- MMWormHole - https://github.com/mutualmobile/MMWormhole
- Apple Watch Programming Guide

8ae8744c09ee9e24e9de32d406c9ed9f?s=128

Jeroen Leenarts

March 06, 2015
Tweet

Transcript

  1. See#the#&me#on#your#wrist Jeroen&Leenarts

  2. None
  3. Abstract For$a$long$)me,$people$were$only$able$to$see$the$)me$on$their$ (smart)phones”.$Apple$came$with$a$brilliant$inven)on$that$allows$us$ to$see$the$)me$on$our$wrist!$Or$perhaps$that’s$just$what$the$ youngest$genera)on$will$think$a$few$years$from$now. Of#course#the#new#Apple#Watch#does#allow#us#to#do#much#more# than#just#see#the#6me.#In#this#session#we#will#see#how#to#use# WatchKit,#how#to#integrate#it#with#exis6ng#apps,#create#Glances# and#Watch#specific#no6fica6ons.

  4. None
  5. None
  6. Now$I$do$lots$of$crypto$stuff with%iOS

  7. Designer(says: That%is%off%by%one%pixel.

  8. CocoaHeads.nl

  9. Topics'of'today • The%Apple%Watch • Developer%overview • Share%data%extension%&%containing%app • Q&A

  10. The$Apple$Watch

  11. 3"days"from"now

  12. One$of$the$biggest$surprises$for$ Apple$Watch$will$be$the$breadth$of$ what$it$will$do. —"Tim"Cook1 1"Tuesday"February"10,"2015"1"Goldman"Sachs"Technology"Conference

  13. Apps Glances No#fica#ons

  14. None
  15. Design'resources Available(on:(h-ps:/ /developer.apple.com/watchkit/ 9(Photoshop(templates 9(Sketch(templates 9(Fonts 9(Style(guides

  16. Developer(overview

  17. Developer(overview

  18. Developer(overview

  19. Developer(overview Apps

  20. Apps • Complements+iOS+app • Paired+with+the+user’s+iPhone • One7on7one+rela8on

  21. Apps • Supports)two)naviga0on)methods • Hierarchical)(tapping) • Page;based)(swiping)

  22. Apps • Supports)two)naviga0on)methods • Hierarchical)(tapping) • Page8based)(swiping)

  23. Apps • Supports)two)naviga0on)methods • Hierarchical)(tapping) • Page%based)(swiping)

  24. Apps • Taps • Ver)cal,swipes,/,Horizontal,swipes,/,Le6,edge,swipes • Force,Touch • The,Digital,Crown

  25. Developer(overview Glances

  26. Glances • Browsable+collec-on+of+-mely+and+contextually+relevant+ moments. • Individually,+a+Glance+is+a+quick+view+of+your+app’s+most+ important+content. • Tapping+your+app’s+glance+interface+always+launches+the+app.

  27. Glances • Template)based • Not/scrollable • Associated/with/a/single/ac8on • Op8onal

  28. Developer(overview No#fica#ons

  29. No#fica#ons • Enabled)by)default,)all)no0fica0ons)can) end)up)on)Watch • Types: • Quick)look • Sta0c)/)Dynamic

  30. No#fica#ons

  31. No#fica#ons • You%can%design%mul0ple%no0fica0ons%by%using%the%no0fica0on% "category" • Think%about%supplying%one%named%"default"

  32. No#fica#ons

  33. Developer(overview Available(components

  34. Available(components

  35. Available(components Groups '(Lay(out(items(horizontally(or(ver5cally '(One(or(more(other(interface(elements You$can$nest$these

  36. Developer(overview Limita&ons

  37. Limita&ons • Avoid'using'technologies'that'request'user'permission • Do'not'use'background'execu:on'modes • Avoid'performing'long<running'tasks • Sharing'data'between'containing'app'and'Watch'extension

  38. Limita&ons • Everything,is,done,within,a,Storyboard,file • Communica:on,over,bluetooth • Simulator,simulates,the,latency

  39. Share&data&extension&&&containing& app

  40. Share&data&extension&&&containing&app Documenta*on+is+very+terse+here+2>+224+words Create&a&shared&app&group .&Use&UserDefaults&for&preferences .&Write&files&to&share&bigger&chunks&of&data Example: objectivec self.sharedDefaults = [[NSUserDefaults

    alloc] initWithSuiteName:@"group.com.xebia.myapp.mywatch "];
  41. Share&data&extension&&&containing&app Enter&technical&note&TN2408 3&File&coordinators&and&shared&containers&is&a&no3no

  42. Share&data&extension&&&containing&app Instead(use *(CFPreferences *(writeToFile:atomically:((Atomic(write) *(SQLite *(Core(Data In#no#way#is#your#data#guaranteed#to#be#stored#with#SQLite#and# Core#Data.

  43. Share&data&extension&&&containing&app Think&about&wri.ng&data&though 1&SQLite&and&Core&Data&double&entries 1&Atomic&writes,&last&writer&wins Storing(in(the(cloud(works(very(well 4(Be(it(CloudKit(or(a(random(web(address

  44. Share&data&extension&&&containing&app What%about openParentApplication:reply: application:handleWatchKitExtensionRequest:reply: ? Well $%Pre(y%slow $%Gets%even%slower%with%more%data $%But%very%useful,%it%wakes%up%the%containing%app

  45. None
  46. Share&data&extension&&&containing&app So#how#to#make#this#easier? How$about$things$like$MMWormhole? 6$This$is$actually$pre;y$decent. 6$Uses$Darwin$no@fica@ons$(Apple$dev$confirms$this$is$ok)

  47. Share&data&extension&&&containing&app As#simple#as [self.wormhole passMessageObject:@{@"buttonNumber" : @(1)} identifier:@"button"]; [self.wormhole listenForMessageWithIdentifier:@"button" listener:^(id

    messageObject) { self.numberLabel.text = [messageObject[@"buttonNumber"] stringValue]; }]; Internally)uses)Darwin)No1fica1ons)and)atomic)writes
  48. Q&A

  49. Links TN2408'('h*ps:/ /developer.apple.com/library/ios/technotes/ tn2408/_index.html Devforums'confirming'Darwin'noFficaFons'is'ok'('h*ps:/ / developer.apple.com/library/ios/technotes/tn2408/_index.html MMWormHole'('h*ps:/ /github.com/mutualmobile/MMWormhole Apple'Watch'Programming'Guide