Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WatchKit | CocoaHeads Hamburg | March 2015

WatchKit | CocoaHeads Hamburg | March 2015

Introduction into WatchKit by Florian Albrecht, Matthias Steeger and Maurício Hanika

Avatar for Maurício Hanika

Maurício Hanika

March 05, 2015

Other Decks in Programming

Transcript

  1. Interface Elements Dates and timers • Display date/time or timer

    • Formattable • Updated directly on the watch
  2. Animations • Only possibility: Image sequences ◦ Static in Watch

    App ◦ Dynamically created in WatchKit Extension
  3. Notifications The iOS device decides which notification is forwarded to

    the WatchApp • system provided short look notification • custom long look notification
  4. Long Look • defined per notification category • scrollable screen

    • non interactive items ◦ buttons addable via payload • static ◦ just customizable via storyboard • dynamic ◦ storyboard ◦ NotificationController class
  5. Notification Interface • app icon • app name (customizable) •

    sash • content area • iOS app defined actions ◦ interactive notification actions ios8 ▪ foregound action (ios app) ▪ background action (WA, handle in interfaceController) • dismiss button
  6. Sharing is Caring How to share data and communicate between

    your Watch App and iOS App. • App Groups • Direct Communication
  7. App Groups • Can be enabled/created in App Project Settings

    -> Capabilities • iOS and Watch App connect to same group • Creates shared Container-Directory accessible via NSFileManager • UserDefaults: NSUserDefaults initWithSuiteName:
  8. Direct Communication • While running the Watch App can communicate

    with the iOS App via: + (BOOL)openParentApplication: (NSDictionary *)userInfo reply:(void (^)( NSDictionary *replyInfo, NSError *error) )reply • iOS App handles it in appDelegate with: - (void)application: (UIApplication *)application handleWatchKitExtensionRequest: (NSDictionary *)userInfo reply:(void(^)( NSDictionary * replyInfo) )reply