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
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
210
たのしいparse.y
ydah
3
120
PHPで作るWebSocketサーバー ~リアクティブなアプリケーションを知るために~ / WebSocket Server in PHP - To know reactive applications
seike460
PRO
2
450
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
330
テストコード文化を0から作り、変化し続けた組織
kazatohiei
2
1.5k
Zoneless Testing
rainerhahnekamp
0
120
MCP with Cloudflare Workers
yusukebe
2
220
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
130
Symfony Mapper Component
soyuka
2
740
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
140
Fibonacci Function Gallery - Part 1
philipschwarz
PRO
0
220
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
Into the Great Unknown - MozCon
thekraken
33
1.5k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
How STYLIGHT went responsive
nonsquared
95
5.2k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Site-Speed That Sticks
csswizardry
2
190
Typedesign – Prime Four
hannesfritz
40
2.4k
We Have a Design System, Now What?
morganepeng
51
7.3k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
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