More Related Content Similar to WatchKit 初探 (20) WatchKit 初探4. Watch apps extend the behavior of existing iOS
apps.The Watch app and WatchKit extension are
bundled together.
from WATCHKITTIPS FOR DEVELOPERS
10. LAUNCHING A WATCHKIT APP
Load initial
interface controller
Initialize UI Display UI
Storyboard
Launch
WatchKit App
Interface Controller
willActivate
awakeWithContext:
init
WatchKit Extension
11. The life cycle of an interface controller
Display UI
User interacts
with UI
User stops
interacting
Interface Controller
willActivate didDeactivateVarious action methods
WatchKit Extension
Suspend
extension
13. HOW IT WORK
iOS App Bundle
WatchKit Extension
Code
Resource
WatchKit WatchKit
WatchKit App
Storyboard
Resource
14. HOW IT WORK
iOS App Bundle
WatchKit Extension
Code
Resource
WatchKit WatchKit
WatchKit App
Storyboard
Resource
15. HOW IT WORK
iOS App Bundle
WatchKit Extension
Code
Resource
WatchKit WatchKit
WatchKit App
Storyboard
Resource
Controller
Modal
View
17. APPLE的⽅方案
• class func openParentApplication(userInfo: [NSObject :AnyObject], reply: (([NSObject :
AnyObject]!, NSError!) ->Void)?) -> Bool
openParentApplication:reply:
reply:
背景模式喚醒App
application:
handleWatchKitExtensionRequest:
reply:
reply([“ShowText”:“Hello”])
• func application(application: UIApplication, handleWatchKitExtensionRequest userInfo:
[NSObject :AnyObject]?, reply: (([NSObject :AnyObject]!) ->Void)!)
26. RESOURCES
• WATCHKITTIPS FOR DEVELOPERS
• WatchKit: Using Handoff in an Apple Watch App
• “My Biggest WatchKit Mistake”
• WatchKit: Initial Impressions
• App与Extensions间通信共享数据
• WatchKit - Zonble
• [iOS] Watch App Architecture | 逍遙⽂文⼯工作室