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

WatchKit @ Betabeers PMI

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →

WatchKit @ Betabeers PMI

WatchKit @ Betabeers PMI 29/01/2015

Avatar for Álvaro Medina Ballester

Álvaro Medina Ballester

January 29, 2015

More Decks by Álvaro Medina Ballester

Other Decks in Programming

Transcript

  1. WatchKit extension Represents the app code. Resides and executes inside

    the iPhone app. WatchKit app Represents the app storyboard, UI and static content. Resides inside the WATCH.
  2. Architecture » Code executes in iPhone app through WatchKit extension.

    » WatchKit app only handles UI and storyboard. » App is developed using WatchKit Framework.
  3. WatchKit Framework » Contains the classes that WatchKit extensions uses.

    » Most important classes for this demo: WKInterfaceController, WKInterfaceTable, WKInterfaceLabel.
  4. WKInterfaceController View controller main class. Only one controller per screen.

    Target-action design pattern. Handles controller lifecycle: awakeWithContext, willActivate, didDeactivate. WKInterfaceTable Can display dynamic content. Needs row controller object to define row content.
  5. Demo: EMT app » A better app for the EMT

    bus service. » Will let you know when the next bus will arrive.
  6. Swift optionals » Optionals can have two states, value or

    nil. » Whenever a function may return a nil value, the compiler will force you to check for it. let str: String // non-optional let optionalStr: String? // optional
  7. Swift optionals func someFunction(param: String) -> String? { if param

    == "betabeers" { return "Cool!" } return nil } let str = someFunction("beer").substringToIndex(4)
  8. Swift optionals func someFunction(param: String) -> String? { if param

    == "betabeers" { return "Cool!" } return nil } // Unwrap value if let str = someFunction("beers") as? String { // }
  9. NO

  10. Conclusions » As with mobile, wereables are a different world

    » Can be a good complement to your app » Knowing iOS/Android development is necessary » Still not complete WatchKit SDK
  11. References » Create a table with WatchKit » WatchKit reference

    » WatchKit programming guide » WatchKit Framework reference » Mike Ash' friday Q&A: Interesting Swift Features » Swift programming guide » Optionals made simple