SlideShare a Scribd company logo
@Hack into the City
Play with watchOS 2.0 by Grady Zhuo
gradyzhuo@gmail.com
Sample Code
https://goo.gl/oTo8PV
How it Work? (watchOS 1)
WatchKit Extension
WatchKit UI
iOS App
WatchKit WatchKit
How it Work? (watchOS 1)
WatchKit Extension
WatchKit UI
iOS App
WatchKit WatchKit
Modified on Architecture
WatchKit Extension
WatchKit UI
iOS App
Available Hardwares
WatchKit Extension
WatchKit UI
Digital Crown
Taptic Engine
Networking
Microphone
Heart Rate Sensor
Accelerometer
Gyroscope
Available System Technologies
WatchKit Extension
WatchKit UI
ClockKit
Contacts
Core Data
Core Foundation
Core Graphics
Core Location
Core Motion
EventKit
Foundation
HealthKit
HomeKit
ImageIO
MapKit
Mobile Core Services
PassKit
Security
System Configuration
Watch Connectivity
WatchKit
Available System Technologies
❖ WatchConnectivity
❖ Complication - ClockKit
❖ Digital Crown - WKInterfacePicker
❖ Haptic - WKInterfaceDevice
❖ MediaPlayer - WKInterfaceController
❖ AudioRecording - WKInterfaceController
How do you get data
to the watch App?
WatchConnectivity NSURLSession
WatchConnectivity
The Watch Connectivity framework
(WatchConnectivity.framework) provides a two-way
communications conduit between an iOS app and a
WatchKit app on a paired Apple Watch.
WatchConnectivity
The Watch Connectivity framework
(WatchConnectivity.framework) provides a two-way
communications conduit between an iOS app and a
WatchKit app on a paired Apple Watch.
Setup
if (WCSession.isSupported()) {
let session = WCSession.defaultSession()
session.delegate = self // conforms to WCSessionDelegate
session.activateSession()

}
Session State
Session State
paired
Session State
watchAppInstalled
paired
Session State
watchAppInstalled
paired
complicationEnabled
Session State
watchAppInstalled
reachable
paired
complicationEnabled
Session State
watchAppInstalled
reachable
paired
complicationEnabled
reachable
3 + 1 Transfer Types
❖ Background transfers
• Application context
• User info transfer
• File transfer
❖ Interactive messaging
• Live communication
Background transfers
Background transfers
❖ Content not needed immediately
❖ OS intelligently transfers content
❖ Queue up content
❖ OS transfers content
❖ Sending side can exit
• Pick opportune time
• Delivers on receiver next launch
Background transfers
❖ Content not needed immediately
❖ OS intelligently transfers content
❖ Queue up content
❖ OS transfers content
❖ Sending side can exit
• Pick opportune time
• Delivers on receiver next launch
Recommended
3 + 1 Transfer Types
❖
• Application context
• User info transfer
• File transfer
❖ Interactive messaging
• Live communication
Background transfers
Application context
❖ Most interesting/relevant content
❖ Overriding behavior
❖ Dictionary
❖ Property list types
❖ Recommended use cases
• Many Apple Watch apps
• Glances
applicationContext receivedApplicationContext
applicationContext receivedApplicationContext
iOS App
iOS App
applicationContext receivedApplicationContext
A
update
iOS App
applicationContext receivedApplicationContext
A
B
update
A
applicationContext
B
iOS App
receivedApplicationContext
B A
applicationContext
B
iOS App
receivedApplicationContext
BB
Watch
Extension
applicationContext
B
iOS App
receivedApplicationContext
B
Current
B
B
User info transfer
❖ Queue user infos (dictionaries)
❖ Property list types(String, Number, Array, Dictionary…)
❖ In memory content
❖ Access to outstanding content in queue
Background Queue Outstanding User Info Transfers
Background Queue Outstanding User Info Transfers
Watch
Game
Background Queue Outstanding User Info Transfers
L1
Background Queue Outstanding User Info Transfers
L1
L2
Background Queue Outstanding User Info Transfers
L1 L2
L3
Background Queue Outstanding User Info Transfers
L1 L2 L3
iOS Game
Background Queue Outstanding User Info Transfers
L1 L2 L3
L1
didReceiveUserInfo
iOS Game
didReceiveUserInfo
Background Queue Outstanding User Info Transfers
L2 L3
L1
L2
Background Queue Outstanding User Info Transfers
L3
iOS Game
L1
L2
L3
didReceiveUserInfo
File transfer
❖ Very similar to user info transfer
❖ Queue files
❖ Access to outstanding content in queue
❖ Additional metadata
❖ Small
• Property list types
Outstanding File Transfers ~/Documents/Inbox/
Outstanding File Transfers ~/Documents/Inbox/
iOS App
A
Outstanding File Transfers ~/Documents/Inbox/
iOS App
B
A
Outstanding File Transfers ~/Documents/Inbox/
iOS App
A B
C
Outstanding File Transfers ~/Documents/Inbox/
iOS App
A B C
Outstanding File Transfers ~/Documents/Inbox/
iOS App
A B C
Watch
Extension
Outstanding File Transfers ~/Documents/Inbox/
iOS App
A B C
didReceiveFile
A
Outstanding File Transfers ~/Documents/Inbox/
iOS App
B C
didReceiveFile
A
B
Outstanding File Transfers ~/Documents/Inbox/
iOS App
C
didReceiveFile
A
B
C
Live communication
❖ Devices connected Watch
❖ Check reachable == true
❖ Small
• Property list types
iOS App
session.reachable == true
Watch
Extension
iOS App
session.reachable == true
sendMessage:
Watch
Extension
A
iOS App
session.reachable == true
Watch
ExtensionR
iOS App
session.reachable == true
Watch
Extension
replyHandler()
R
Live communication
func sendMessage(
message: [String : AnyObject],
replyHandler: (([String : AnyObject]) -> Void)?,
errorHandler: ((NSError) -> Void)?
)
optional func session(
session: WCSession,
didReceiveMessageData messageData: NSData,
replyHandler: (NSData) -> Void
)
On Receiver side (by delegate)
On Sender Side
Clock Face
Clock Face
Complication
Complication Families
CLKComplicationTemplate
CLKComplicationTemplate
ModularLargeStandardBody
class CLKComplicationTemplateModularLargeStandardBody : CLKComplicationTemplate {
var headerTextProvider : CLKTextProvider
var body1TextProvider : CLKTextProvider
var body2TextProvider : CLKTextProvider?
var headerImageProvider : CLKImageProvider?
}
CLKComplication
DataSource
CLKComplication
Server
Reload
Timeline
WatchKit
Extension
Time Travel
Timeline
9:00
Lunch!
12:00 PM
12:00
Coffee!
1:30 PM
1:30
Dinner!
6:30 PM
Timeline Entry
9:00
Lunch!
12:00 PM
Timeline Entry
12:00
Coffee!
1:30 PM
Timeline Entry
1:30
Dinner!
6:30 PM
9:00 12:00 1:00 2:00
Time Travel
Configure
Configure
Summary
❖ Extension has been moved to on Watch.
❖ All the most hardware API on the Watch can be used.
❖ Connect with iOS App by WatchConnectivity.
❖ Complications can be provided by Watch App.
❖ Almost all CocoaTouch frameworks are supported.
❖ Now you can play Taptic Engine.
❖ Digital Crown can be used on Simulator.
Thanks for your attention

More Related Content

Viewers also liked

《快樂的15個習慣》
《快樂的15個習慣》《快樂的15個習慣》
《快樂的15個習慣》
TONI TONG
 
說明會 Letron 500
說明會 Letron 500說明會 Letron 500
說明會 Letron 500
Aiken Lin
 
Letron Quick Installation Guide (Chinese)
Letron Quick Installation Guide (Chinese)Letron Quick Installation Guide (Chinese)
Letron Quick Installation Guide (Chinese)
Aiken Lin
 
1050502教育委員會質詢 許毓仁
1050502教育委員會質詢 許毓仁1050502教育委員會質詢 許毓仁
1050502教育委員會質詢 許毓仁
毓仁 許
 

Viewers also liked (9)

Mobile web develop
Mobile web developMobile web develop
Mobile web develop
 
《快樂的15個習慣》
《快樂的15個習慣》《快樂的15個習慣》
《快樂的15個習慣》
 
說明會 Letron 500
說明會 Letron 500說明會 Letron 500
說明會 Letron 500
 
Letron Quick Installation Guide (Chinese)
Letron Quick Installation Guide (Chinese)Letron Quick Installation Guide (Chinese)
Letron Quick Installation Guide (Chinese)
 
策展・用心觸動生命 Curation・Touching Life with Your Heart
策展・用心觸動生命 Curation・Touching Life with Your Heart策展・用心觸動生命 Curation・Touching Life with Your Heart
策展・用心觸動生命 Curation・Touching Life with Your Heart
 
Apple - what's new in iOS 10, watchOS 3 & tvOS 10
Apple - what's new in iOS 10, watchOS 3 & tvOS 10Apple - what's new in iOS 10, watchOS 3 & tvOS 10
Apple - what's new in iOS 10, watchOS 3 & tvOS 10
 
1050502教育委員會質詢 許毓仁
1050502教育委員會質詢 許毓仁1050502教育委員會質詢 許毓仁
1050502教育委員會質詢 許毓仁
 
Rainnie的自我介紹
Rainnie的自我介紹Rainnie的自我介紹
Rainnie的自我介紹
 
招商簡報 0905
招商簡報 0905招商簡報 0905
招商簡報 0905
 

Similar to Watch os 2.0

Similar to Watch os 2.0 (20)

Build a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million UsersBuild a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million Users
 
01 introduction
01 introduction01 introduction
01 introduction
 
Titanium Overview (Mobile March 2011)
Titanium Overview (Mobile March 2011)Titanium Overview (Mobile March 2011)
Titanium Overview (Mobile March 2011)
 
Pentesting iOS Applications
Pentesting iOS ApplicationsPentesting iOS Applications
Pentesting iOS Applications
 
WatchOS 2 Opportunity for native apps
WatchOS 2 Opportunity for native appsWatchOS 2 Opportunity for native apps
WatchOS 2 Opportunity for native apps
 
Apple WatchOS 2 Opportunity for Native Apps (Vladimir Zgonik Technology Stream)
Apple WatchOS 2 Opportunity for Native Apps (Vladimir Zgonik Technology Stream)Apple WatchOS 2 Opportunity for Native Apps (Vladimir Zgonik Technology Stream)
Apple WatchOS 2 Opportunity for Native Apps (Vladimir Zgonik Technology Stream)
 
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...
G4H Webcast: Automated Security Analysis of Mobile Applications with Mobile S...
 
Rails as iOS Application Backend
Rails as iOS Application BackendRails as iOS Application Backend
Rails as iOS Application Backend
 
Build an App on AWS for Your First 10 Million Users
Build an App on AWS for Your First 10 Million UsersBuild an App on AWS for Your First 10 Million Users
Build an App on AWS for Your First 10 Million Users
 
NASA Space Apps Expo
NASA Space Apps ExpoNASA Space Apps Expo
NASA Space Apps Expo
 
Introduction to Realm Mobile Platform
Introduction to Realm Mobile PlatformIntroduction to Realm Mobile Platform
Introduction to Realm Mobile Platform
 
Build a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million UsersBuild a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million Users
 
Couchbase Mobile on Android
Couchbase Mobile on AndroidCouchbase Mobile on Android
Couchbase Mobile on Android
 
Outsmarting SmartPhones
Outsmarting SmartPhonesOutsmarting SmartPhones
Outsmarting SmartPhones
 
iOS Hacking: Advanced Pentest & Forensic Techniques
iOS Hacking: Advanced Pentest & Forensic TechniquesiOS Hacking: Advanced Pentest & Forensic Techniques
iOS Hacking: Advanced Pentest & Forensic Techniques
 
CONFidence 2015: iOS Hacking: Advanced Pentest & Forensic Techniques - Omer S...
CONFidence 2015: iOS Hacking: Advanced Pentest & Forensic Techniques - Omer S...CONFidence 2015: iOS Hacking: Advanced Pentest & Forensic Techniques - Omer S...
CONFidence 2015: iOS Hacking: Advanced Pentest & Forensic Techniques - Omer S...
 
iOS 11からのアプリ間ファイル共有_公開用
iOS 11からのアプリ間ファイル共有_公開用iOS 11からのアプリ間ファイル共有_公開用
iOS 11からのアプリ間ファイル共有_公開用
 
[CocoaHeads Tricity] Do not reinvent the wheel
[CocoaHeads Tricity] Do not reinvent the wheel[CocoaHeads Tricity] Do not reinvent the wheel
[CocoaHeads Tricity] Do not reinvent the wheel
 
Citrix Mobile Receiver Techtalk
Citrix Mobile Receiver TechtalkCitrix Mobile Receiver Techtalk
Citrix Mobile Receiver Techtalk
 
Intro to appcelerator
Intro to appceleratorIntro to appcelerator
Intro to appcelerator
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 

Watch os 2.0