Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Building watchOS apps
Search
Boris Bügling
July 13, 2015
Programming
2
190
Building watchOS apps
An introduction to building watchOS apps, given at Mobile Optimized 2015 in Minsk.
Boris Bügling
July 13, 2015
Tweet
Share
More Decks by Boris Bügling
See All by Boris Bügling
Testing ⌚️ Apps and Other Extensions
neonichu
1
4.6k
Cross-platform Swift
neonichu
4
18k
Building better API clients in Swift
neonichu
1
290
Cross-platform Swift
neonichu
3
880
Swift Package Manager
neonichu
2
320
Swift Package Manager
neonichu
0
50
📺
neonichu
0
2k
Cross-Platform Swift
neonichu
0
74
Swift Package Manager
neonichu
6
4.3k
Other Decks in Programming
See All in Programming
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
1
370
Haze - Real time background blurring
chrisbanes
1
510
Beyond ORM
77web
2
330
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
第5回日本眼科AI学会総会_AIコンテスト_3位解法
neilsaw
0
170
CSC509 Lecture 14
javiergs
PRO
0
140
103 Early Hints
sugi_0000
1
230
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
暇に任せてProxmoxコンソール 作ってみました
karugamo
1
720
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
229
18k
For a Future-Friendly Web
brad_frost
175
9.4k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
A Modern Web Designer's Workflow
chriscoyier
693
190k
How to Ace a Technical Interview
jacobian
276
23k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
A designer walks into a library…
pauljervisheath
204
24k
It's Worth the Effort
3n
183
28k
Imperfection Machines: The Place of Print at Facebook
scottboms
266
13k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Side Projects
sachag
452
42k
Transcript
BUILDING WATCHOS APPS MOBILEOPTIMIZED 2015 BORIS BÜGLING - @NEONACHO
COCOAPODS
CONTENTFUL
None
!!!!
ᴡᴀᴛᴄʜ
WATCHOS 1.X ▸ Notifications ▸ Glances ▸ WatchKit apps
NOTIFICATIONS
GLANCES
WATCHKIT
WATCHOS 2.X ▸ Apps run natively on the watch ▸
Custom complications
!!!
None
COMPLICATIONS
ARCHITECTURE
None
WATCHOS 2 Extension phone => watch
RESOURCES ▸ Interface.storyboard ▸ Asset catalogs
EXTENSION DELEGATE class ExtensionDelegate: NSObject, WKExtensionDelegate { func applicationDidFinishLaunching() {
} func applicationDidBecomeActive() { } func applicationWillResignActive() { } }
INTERFACE CONTROLLER class InterfaceController: WKInterfaceController { override func awakeWithContext(context: AnyObject?)
{ super.awakeWithContext(context) } override func willActivate() { super.willActivate() } override func didDeactivate() { super.didDeactivate() } }
WKINTERFACECONTROLLER ▸ Navigation ▸ Presentation ▸ Handoff ▸ Handle notification
actions ▸ Communicate with parent app
DESIGN
If you measure interactions with your iOS app in minutes,
you can expect interactions with your Watch app to be measured in seconds.
PRINCIPLES ▸ Lightweight interactions ▸ Holistic design ▸ Personal communication
LAYOUT ▸ based on horizontal or vertical groups ▸ very
similar to UIStackView ▸ two device sizes (38mm and 42mm) ▸ edge-to-edge, bezel provides margins
None
SOME EXAMPLES
None
None
None
None
None
BUILDING A SIMPLE APP
None
WATCHPRESENTER ▸ Remote controls Deckset instead ▸ Direct connection to
the Mac ▸ Shows a preview of the slides ▸ Measures heartrate to display the "most exciting" slide ▸ Taps you if you're running out of time
MULTIPEER CONNECTIVITY!
AVAILABLE FRAMEWORKS
CFNetwork.framework ClockKit.framework Contacts.framework CoreData.framework CoreFoundation.framework CoreGraphics.framework CoreLocation.framework CoreMotion.framework EventKit.framework Foundation.framework
HealthKit.framework HomeKit.framework ImageIO.framework MapKit.framework MobileCoreServices.framework PassKit.framework Security.framework UIKit.framework WatchConnectivity.framework WatchKit.framework
BT APIS ARE PRIVATE :(
OTHER OPTIONS ▸ NSURLSession via Wi-Fi ▸ WatchConnectivity.framework to talk
via the phone
HEALTHKIT.FRAMEWORK let anchorValue = Int(HKAnchoredObjectQueryNoAnchor) let sampleType = HKObjectType.quantityTypeForIdentifier(HKQuantityTypeIdentifierHeartRate) let
heartRateQuery = HKAnchoredObjectQuery(type: sampleType!, predicate: nil, anchor: anchorValue, limit: 0) { (query, sampleObjects, deletedObjects, newAnchor, error) -> Void in guard let heartRateSamples = sampleObjects as?[HKQuantitySample] else {return} let sample = heartRateSamples.first let value = sample!.quantity.doubleValueForUnit(self.heartRateUnit) print(value) } heartRateQuery.updateHandler = // ...
None
HEALTHKIT.FRAMEWORK ▸ not usable in the Watch simulator
TAPTIC ENGINE typedef NS_ENUM(NSInteger, WKHapticType) { WKHapticTypeNotification, WKHapticTypeDirectionUp, WKHapticTypeDirectionDown, WKHapticTypeSuccess,
WKHapticTypeFailure, WKHapticTypeRetry, WKHapticTypeStart, WKHapticTypeStop, WKHapticTypeClick } WK_AVAILABLE_WATCHOS_ONLY(2.0); WKInterfaceDevice.currentDevice().playHaptic(.Start)
BUT ALSO NOT USABLE IN THE SIM
SPOTIFY REMOTE
DEMO
None
None
None
TIPS
printf DEBUGGING IS GREAT!
MMWORMHOLE ▸ watchOS 1.0: CFNotificationCenter ▸ watchOS 2.0: WatchConnectivity.framework
FORCE QUIT APPS ▸ Long press until "reboot" menu ▸
Long press again
IF IN DOUBT, REBOOT THE WATCH :)
WHAT HAVE WE LEARNED? ▸ Code isn't very different from
iOS apps ▸ But design very much is ▸ Rethink your app for the watch, don't port it ▸ If you can't - maybe you don't need a watch app
Don’t be afraid to not ship. @orta
THANK YOU!
▸ https://developer.apple.com/watch/human-interface-guidelines/ ▸ https://developer.apple.com/library/prerelease/watchos/ documentation/General/Conceptual/AppleWatch2TransitionGuide/ ▸ https://github.com/shu223/watchOS-2-Sampler ▸ http://www.kristinathai.com/category/watchkit/ ▸
https://realm.io/news/watchkit-mistakes/
@NeoNacho
[email protected]
http://buegling.com/talks