Date post: | 17-Jan-2017 |
Category: |
Technology |
Upload: | natasha-murashev |
View: | 245 times |
Download: | 0 times |
👋⌚2@NatashaTheRobot
👋⌚2
• Complications
• Watch Connectivity
Complicationsit’s complicated 🤔
Creating Complications with ClockKit
WWDC15 Session 209
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?