We held another theEvnt workshop at Tuenti where Víctor Corugedo, César Estébanez and Eduardo González (Tuenti iOS Team members) gave a complete workshop about WatchKit SDK and how to develop Apple Watch Apps.
• Glances • Timely read-only information. Lightweight view on watch app. • Glances do not scroll • Glance interface must fit on a single screen. • Optionals and watch could turn them on/off when they want :) • Tapping launches watch app (deep linking)
• Notifications • Short supported by default (Local/Remote) • Displays alert message from notification • Long Look interface • Static version • Dinamic Version
• Two separate bundles: • Watch app runs on Apple Watch • WatchKit Extension runs on user’s iPhone • UI Resources stored on the Watch App • Code runs on WatchKit extension manages Watch App user interfaces and respond to user interactions
• WatchKit App & WatchKit Extension are packaged inside iOS App bundle • During installation of your iOS app, the system prompts the user to install the WatchKit app when a paired Apple Watch is present.
• Each scene is managed by a single interface controller object, which is an instance of the WKInterfaceController class. • Interface controller presents and manages content on the screen and responds to user interactions with that content. • Only one controller at a time is displayed onscreen.
Make sure that you don't accidentally corrupt the data. Sharing data files means there might be more than one process trying to use a file at the same time.
Labels (WKInterfaceLabel) • Display static formatted text • Supports standard and custom fonts • Can be internationalized • For text input: Dictation or standard set of phrases or emoji
Images (WKInterfaceImage) • Display single image or a sequence of images • Control animations programmatically • Images or image names are transferred wirelessly • Use images names from app bundle • Cache when possible
Groups and Separators (WKInterfaceGroup & WKInterfaceSeparator) • Groups • Container for other interface objects or other groups • Layout horizontal or vertically • Separators • Separating content in a view
Tables (WKInterfaceTable) • Support for single column tables and multiple row types • No data source nor delegate • Define row layout in storyboard and connect with row controllers • WKInterfaceController adds rows and handles interactions
Buttons, Switches and Slider (WKInterfaceButton & WKInterfaceSwitch & WKInterfaceSlider) • Buttons • Can contain a single label or group • Sliders • Discrete or continuous • One image at each end
Dates and Timers (WKInterfaceDate & WKInterfaceTimer) • Specialized labels • Don’t require to be updated by a WatchKit extension • Configure display through different formats and calendars
Reuse Code! • User Embedded Frameworks to share code between iOS App and WatchKit Extension • Limitations: • Extensions and iOS app run in separated processes • Some APIs are not available to App Extensions • Access sharedApplication • Camera, micro • Long-running background tasks (networking!) • HealthKit, EventKit UI, AirDrop, etc.
WatchKit Extension iOS App Embedded API DB Data ? Storage Background NSURLSessionTask + App Groups WatchKit App Architecture application:handleEventsForBackgroundURLSession:completionHandler:
WatchKit Extension iOS App Embedded API DB Data Communicating with containing App Storage Network iOS WatchKit App Architecture WKInterfaceController openParentApplication:reply:
WatchKit Extension iOS App Embedded WKInterfaceController M M Business Presentation WKInterfaceController API DB Data Storage Network iOS WatchKit App Architecture
WatchKit Extension iOS App Embedded WKInterfaceController I M M Business Presentation WKInterfaceController API DB Data Storage Network iOS I WatchKit App Architecture
Pro Tips • Inter-process Communication & Debugging • Write tests. No, seriously. • Serialisation for inter-process communication • NSCoding • NSSecureCoding!