Save 37% off PRO during our Black Friday Sale! »

Practical WatchKit Development (UIKonf 2015)

Practical WatchKit Development (UIKonf 2015)

Presentation at UIKonf 2015 in Berlin http://www.uikonf.com

Ae2cc3279f2c24525c0dcae7063834d3?s=128

Claus Höfele

May 18, 2015
Tweet

Transcript

  1. Practical WatchKit Development @claushoefele

  2. Kleinanzeigen TransitHopper

  3. WatchKit App WatchKit Extension iOS App WatchKit App vs Extension

  4. None
  5. Interactive Notifications

  6. class TripDetailInterfaceController: WKInterfaceController { @IBOutlet private weak var map: WKInterfaceMap!

    override func awakeWithContext(context: AnyObject?) { super.awakeWithContext(context) ... } override func willActivate() { super.willActivate() ... } }
  7. map.addAnnotation(coordinate, withPinColor: .Red) let coordinateRegion = MKCoordinateRegionMakeWithDistance[...] map.setRegion(coordinateRegion)

  8. Tables

  9. Paging

  10. Hides when loading Off On

  11. None
  12. WatchKit App WatchKit Extension Requesting Data

  13. WatchKit App WatchKit Extension iOS App openParentApplication()

  14. private func callParentApp() { let userInfo = ["input": "data"] WKInterfaceController.openParentApplication(userInfo)

    { replyInfo, error in println("reply \(replyInfo)") } } func application(_:handleWatchKitExtensionRequest:reply:) Calling the Parent App
  15. Handoff

  16. User Location Permissions WatchKit App WatchKit Extension iOS App When

    In Use Always
  17. WatchKit Extension iOS App Sharing Data

  18. None
  19. let defaults = NSUserDefaults(suiteName: "group.com.claushoefele.T")! func updateObjectForKey<T: NSCoding>(key: String, item:

    T) { let data = NSKeyedArchiver.archivedDataWithRootObject(item) defaults.setObject(data, forKey: key) }
  20. WatchKit Extension iOS App Signalling

  21. func sendDarwinNotification(identifier: String) { let darwinNotificationCenter = CFNotificationCenterGetDarwinNotifyCenter() CFNotificationCenterPostNotification(darwinNotificationCenter, identifier,

    nil, nil, 1); } CFNotificationCenterAddObserver
  22. Data Sync

  23. “A WatchKit app complements your iOS app; it does not

    replace it.” –Apple Watch HIG
  24. “Anything that could show the user a progress spinner (however

    briefly) is a failure on my part.” –David Smith
  25. “[…] many of us —  developers included — are still figuring out how

    this device fits into daily life […]” –M.G. Siegler
  26. Practical WatchKit Development @claushoefele http://slack.fiveminutewatchkit.com