hello watchos2
TRANSCRIPT
šā2@NatashaTheRobot
šā2
ā¢ Complications
ā¢ Watch Connectivity
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() }
import WatchConnectivity
class WatchSessionManager: NSObject, WCSessionDelegate { static let sharedManager = WatchSessionManager() private override init() { super.init() } private let session: WCSession? = WCSession.isSupported() ? WCSession.defaultSession() : nil // no need for the check on the Watch App: // private let session = WCSession.defaultSession() func startSession() { session?.delegate = self session?.activateSession() }
Code Sample
šā2
ā¢ Complications
ā¢ Watch Connectivity
Which future will you build for?