how to win on the apple watch
TRANSCRIPT
How to Win on the Apple Watch
@NatashaTheRobot
How to Win on the ⌚
• Notifications
• Complications
• Watch Connectivity
Notifications
// NotificationController override func didReceiveRemoteNotification( remoteNotification: [NSObject : AnyObject], withCompletion completionHandler: ((WKUserNotificationInterfaceType) -> Void)) { // This method is called when // a remote notification needs to be presented. // Implement it if you use a dynamic // notification interface. // Populate your dynamic notification interface // as quickly as possible. // // After populating your dynamic notification // interface call the completion block. completionHandler(.Custom) //completionHandler(.Default) }
// InterfaceController override func handleActionWithIdentifier( identifier: String?, forRemoteNotification remoteNotification: [NSObject : AnyObject]) { if let identifier = identifier where identifier == "showMinionsAction" { // configure display } }
Complicationsit’s complicated 🤔
Creating Complications with ClockKit
WWDC15 Session 209
https://github.com/tryswift/trySwiftApp
DO Repeat Yourself
// iOS app struct Session { let startTime: NSDate let endTime: NSDate let description: String let location: String let speaker: Speaker? }
// Watch App struct Session { let startTime: NSDate let endTime: NSDate let location: String let speaker: Speaker? let index: Int }
DO Repeat Yourself
but not too much…
Watch Connectivity
Background Data Transfer
• application context
• application context
• user info transfer
• application context
• user info transfer
• file transfer
Interactive Messaging
• Immediate Information Transfer
• Requires reachable state
WCSession
// check needed for iOS App Only if WCSession.isSupported() { // activate session for both! let session = WCSession.defaultSession() session.delegate = self session.activateSession() }
How to Win on the ⌚
• Notifications
• Complications
• Watch Connectivity
Which future will you build for?