際際滷

際際滷Share a Scribd company logo
WKInterfaceMap on Apple Watch
trippiece Inc.
@kitasuke
Restaurant finder app
in Shibuya
10 things you should
know about watchkit
before you submit
See this one as well
There are limitations
on WKInterfaceMap
at this time
Current limitations
? Request location access on iPhone, not Apple Watch
? Not scrollable on map
? Not zoomable on map
? Not opening Apple's map app
? 5 annotations at maximum
Location service
var locationManager = CLLocationManager()
override init() {
super.init()
locationManager.delegate = self
if CLLocationManager.locationServicesEnabled() {
switch CLLocationManager.authorizationStatus() {
case .AuthorizedAlways, .AuthorizedWhenInUse:
locationManager.startUpdatingLocation()
}
}
}
func locationManager(manager: CLLocationManager!, didUpdateToLocation newLocation: CLLocation!,
fromLocation oldLocation: CLLocation!) {
}
Use Handoff in case it's not granted yet
override init() {
let type = "com.example.com"
let userInfo = ["actionID": 1]
self.updateUserActivity(type, userInfo: userInfo, webpageURL: nil)
}
Annotation
No annotation for current location
Use custom image instead
Cache
Cache annotation images
let image = UIImage()
let device = WKInterfaceDevice.currentDevice()
device.addCachedImage(image, name: "annotation")
self.mapView.addAnnotation(CLLocationCoordinate2DMake(0.0, 0.0)
withImageNamed:"annotation"
centerOffset:CGPointZero)
Realm
Realm is a replacement for SQLite & Core Data. It can save you
thousands of lines of code & weeks of work, and lets you craft
amazing new user experiences.
Why Realm?
Usage between iOS and WatchKit
// Get the shared directory for the application group
let id = "group.com.example.my-app"
let fileManager = NSFileManager.defaultManager()
let container = fileManager.containerURLForSecurityApplicationGroupIdentifier(id)
// Set the default realm path to a location in the shared container
let fileName = "defualt.realm"
if let realmURL = container?.URLByAppendingPathComponent(fileName) {
RLMRealm.setDefaultRealmPath(realmURL.path)
}
// Get location info
let restaurant = Restaurant.allObjects().firstObject() as! Restaurant
let coordinate = CLLocationCoordinate2DMake(restaurant.latitude, restaurant.longitude)
App review
We found that the usefulness of your Apple Watch app is limited
by the minimal features it includes. Speci?cally, your Apple Watch
app only launches out to Maps.
! From Apple
There are tons of
functions, but make it
simple
WKInterfaceMap on Apple Watch
?PagingMenuItem??SegmentedControl
Usage
let viewController = UIViewController()
viewController.title = "Menu title"
let viewControllers = [viewController]
let options = PagingMenuOptions()
options.menuHeight = 50
let pagingMenuController = self.childViewControllers.first as! PagingMenuController
pagingMenuController.setup(viewControllers: viewControllers, options: options)
Welcome your feedback
https://github.com/kitasuke/PagingMenuController

More Related Content

Viewers also liked (13)

PDF
Swift core
Yusuke Kita
?
PDF
Useful and Practical Functionalities in Realm
Yusuke Kita
?
PPTX
雨庄テスト葵霞庄糸艶厩
Yusuke Kita
?
PDF
安安禽遺のチケット翌れても皆酷に佩った圭が措い尖喇
Yusuke Kita
?
PDF
Protocol in Swift
Yusuke Kita
?
PDF
Introducing Cardio
Yusuke Kita
?
PDF
Search APIs in Spotlight and Safari
Yusuke Kita
?
PDF
Advanced realm in swift
Yusuke Kita
?
PPTX
庄或皆における雨鴛テスト葵沿看岳艶岳看岳庄沿壊
Yusuke Kita
?
PDF
User Scenario based UI testing with KIF
Yusuke Kita
?
PDF
How to make workout app for watch os 2
Yusuke Kita
?
PDF
Command Line Tool in swift
Yusuke Kita
?
PDF
Apple Watch g宥佚
Shuichi Tsutsumi
?
Swift core
Yusuke Kita
?
Useful and Practical Functionalities in Realm
Yusuke Kita
?
雨庄テスト葵霞庄糸艶厩
Yusuke Kita
?
安安禽遺のチケット翌れても皆酷に佩った圭が措い尖喇
Yusuke Kita
?
Protocol in Swift
Yusuke Kita
?
Introducing Cardio
Yusuke Kita
?
Search APIs in Spotlight and Safari
Yusuke Kita
?
Advanced realm in swift
Yusuke Kita
?
庄或皆における雨鴛テスト葵沿看岳艶岳看岳庄沿壊
Yusuke Kita
?
User Scenario based UI testing with KIF
Yusuke Kita
?
How to make workout app for watch os 2
Yusuke Kita
?
Command Line Tool in swift
Yusuke Kita
?
Apple Watch g宥佚
Shuichi Tsutsumi
?

Similar to WKInterfaceMap on Apple Watch (7)

PDF
Introduction to the geolocation & Apple's maps API
Julian Kr┏l
?
PPTX
Apple Watch and WatchKit - A Technical Overview
Sammy Sunny
?
PPTX
Under the mask of privacy
Andriy M
?
PDF
Core Location and Map Kit: Bringing Your Own Maps [Voices That Matter: iPhone...
Chris Adamson
?
PDF
Apple Watch Development w/ Xamarin Watch Kit
Tom Soderling
?
PDF
Geolocation for Mobile Apps - Connect.tech Atlanta, 2017
Adam Paxton
?
PDF
Apple Watch Development with Xamarin Watch Kit
Tom Soderling
?
Introduction to the geolocation & Apple's maps API
Julian Kr┏l
?
Apple Watch and WatchKit - A Technical Overview
Sammy Sunny
?
Under the mask of privacy
Andriy M
?
Core Location and Map Kit: Bringing Your Own Maps [Voices That Matter: iPhone...
Chris Adamson
?
Apple Watch Development w/ Xamarin Watch Kit
Tom Soderling
?
Geolocation for Mobile Apps - Connect.tech Atlanta, 2017
Adam Paxton
?
Apple Watch Development with Xamarin Watch Kit
Tom Soderling
?
Ad

More from Yusuke Kita (19)

PDF
Integrating libSyntax into the compiler pipeline
Yusuke Kita
?
PDF
Making your own tool using SwiftSyntax
Yusuke Kita
?
PDF
[Deprecated] Integrating libSyntax into the compiler pipeline
Yusuke Kita
?
PDF
Creating your own Bitrise step
Yusuke Kita
?
PDF
Introducing swift-format
Yusuke Kita
?
PDF
Unidirectional Data Flow Through SwiftUI
Yusuke Kita
?
PDF
Open Source Swift Workshop
Yusuke Kita
?
PDF
Contributing to Swift Compiler
Yusuke Kita
?
PDF
Writing a compiler in go
Yusuke Kita
?
PDF
Writing an interpreter in swift
Yusuke Kita
?
PDF
SIL Optimizations - AllocBoxToStack
Yusuke Kita
?
PDF
SIL for First Time Learners
Yusuke Kita
?
PDF
var, let in SIL
Yusuke Kita
?
PDF
SIL for First Time Leaners LT
Yusuke Kita
?
PDF
How to try! Swift
Yusuke Kita
?
PDF
SIL for the first time
Yusuke Kita
?
PDF
Introducing protobuf in Swift
Yusuke Kita
?
PDF
Type-safe Web APIs with Protocol Buffers in Swift at AltConf
Yusuke Kita
?
PDF
Type-safe Web APIs with Protocol Buffers in Swift at iOSCon
Yusuke Kita
?
Integrating libSyntax into the compiler pipeline
Yusuke Kita
?
Making your own tool using SwiftSyntax
Yusuke Kita
?
[Deprecated] Integrating libSyntax into the compiler pipeline
Yusuke Kita
?
Creating your own Bitrise step
Yusuke Kita
?
Introducing swift-format
Yusuke Kita
?
Unidirectional Data Flow Through SwiftUI
Yusuke Kita
?
Open Source Swift Workshop
Yusuke Kita
?
Contributing to Swift Compiler
Yusuke Kita
?
Writing a compiler in go
Yusuke Kita
?
Writing an interpreter in swift
Yusuke Kita
?
SIL Optimizations - AllocBoxToStack
Yusuke Kita
?
SIL for First Time Learners
Yusuke Kita
?
var, let in SIL
Yusuke Kita
?
SIL for First Time Leaners LT
Yusuke Kita
?
How to try! Swift
Yusuke Kita
?
SIL for the first time
Yusuke Kita
?
Introducing protobuf in Swift
Yusuke Kita
?
Type-safe Web APIs with Protocol Buffers in Swift at AltConf
Yusuke Kita
?
Type-safe Web APIs with Protocol Buffers in Swift at iOSCon
Yusuke Kita
?
Ad

Recently uploaded (20)

PPTX
Precooling and Refrigerated storage.pptx
ThongamSunita
?
PDF
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
?
PDF
Rapid Prototyping for XR: Lecture 5 - Cross Platform Development
Mark Billinghurst
?
PPTX
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
?
PDF
i氏Y創_Miipher and Miipher2 .
鰻粥京晦粥皆幄塀氏芙
?
PPTX
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
?
PPTX
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
?
PPTX
How to Un-Obsolete Your Legacy Keypad Design
Epec Engineered Technologies
?
PDF
Decision support system in machine learning models for a face recognition-bas...
TELKOMNIKA JOURNAL
?
PDF
How to Buy Verified CashApp Accounts IN 2025
Buy Verified CashApp Accounts
?
PDF
June 2025 Top 10 Sites -Electrical and Electronics Engineering: An Internatio...
elelijjournal653
?
PDF
01-introduction to the ProcessDesign.pdf
StiveBrack
?
PPTX
CST413 KTU S7 CSE Machine Learning Clustering K Means Hierarchical Agglomerat...
resming1
?
PPTX
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
?
PPT
FINAL plumbing code for board exam passer
MattKristopherDiaz
?
PPTX
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
?
PDF
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Mark Billinghurst
?
PDF
????? ?? ??????? ?????????? ????? ?????? ??? ????.pdf
???? ??? ?????
?
PPT
SF 9_Unit 1.ppt software engineering ppt
AmarrKannthh
?
PPTX
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
?
Precooling and Refrigerated storage.pptx
ThongamSunita
?
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
?
Rapid Prototyping for XR: Lecture 5 - Cross Platform Development
Mark Billinghurst
?
Stability of IBR Dominated Grids - IEEE PEDG 2025 - short.pptx
ssuser307730
?
i氏Y創_Miipher and Miipher2 .
鰻粥京晦粥皆幄塀氏芙
?
FSE_LLM4SE1_A Tool for In-depth Analysis of Code Execution Reasoning of Large...
cl144
?
Tesla-Stock-Analysis-and-Forecast.pptx (1).pptx
moonsony54
?
How to Un-Obsolete Your Legacy Keypad Design
Epec Engineered Technologies
?
Decision support system in machine learning models for a face recognition-bas...
TELKOMNIKA JOURNAL
?
How to Buy Verified CashApp Accounts IN 2025
Buy Verified CashApp Accounts
?
June 2025 Top 10 Sites -Electrical and Electronics Engineering: An Internatio...
elelijjournal653
?
01-introduction to the ProcessDesign.pdf
StiveBrack
?
CST413 KTU S7 CSE Machine Learning Clustering K Means Hierarchical Agglomerat...
resming1
?
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
?
FINAL plumbing code for board exam passer
MattKristopherDiaz
?
Comparison of Flexible and Rigid Pavements in Bangladesh
Arifur Rahman
?
Rapid Prototyping for XR: Lecture 6 - AI for Prototyping and Research Directi...
Mark Billinghurst
?
????? ?? ??????? ?????????? ????? ?????? ??? ????.pdf
???? ??? ?????
?
SF 9_Unit 1.ppt software engineering ppt
AmarrKannthh
?
Bharatiya Antariksh Hackathon 2025 Idea Submission PPT.pptx
AsadShad4
?

WKInterfaceMap on Apple Watch

  • 1. WKInterfaceMap on Apple Watch trippiece Inc. @kitasuke
  • 3. 10 things you should know about watchkit before you submit See this one as well
  • 4. There are limitations on WKInterfaceMap at this time
  • 5. Current limitations ? Request location access on iPhone, not Apple Watch ? Not scrollable on map ? Not zoomable on map ? Not opening Apple's map app ? 5 annotations at maximum
  • 6. Location service var locationManager = CLLocationManager() override init() { super.init() locationManager.delegate = self if CLLocationManager.locationServicesEnabled() { switch CLLocationManager.authorizationStatus() { case .AuthorizedAlways, .AuthorizedWhenInUse: locationManager.startUpdatingLocation() } } } func locationManager(manager: CLLocationManager!, didUpdateToLocation newLocation: CLLocation!, fromLocation oldLocation: CLLocation!) { }
  • 7. Use Handoff in case it's not granted yet override init() { let type = "com.example.com" let userInfo = ["actionID": 1] self.updateUserActivity(type, userInfo: userInfo, webpageURL: nil) }
  • 8. Annotation No annotation for current location Use custom image instead
  • 9. Cache Cache annotation images let image = UIImage() let device = WKInterfaceDevice.currentDevice() device.addCachedImage(image, name: "annotation") self.mapView.addAnnotation(CLLocationCoordinate2DMake(0.0, 0.0) withImageNamed:"annotation" centerOffset:CGPointZero)
  • 10. Realm Realm is a replacement for SQLite & Core Data. It can save you thousands of lines of code & weeks of work, and lets you craft amazing new user experiences.
  • 12. Usage between iOS and WatchKit // Get the shared directory for the application group let id = "group.com.example.my-app" let fileManager = NSFileManager.defaultManager() let container = fileManager.containerURLForSecurityApplicationGroupIdentifier(id) // Set the default realm path to a location in the shared container let fileName = "defualt.realm" if let realmURL = container?.URLByAppendingPathComponent(fileName) { RLMRealm.setDefaultRealmPath(realmURL.path) } // Get location info let restaurant = Restaurant.allObjects().firstObject() as! Restaurant let coordinate = CLLocationCoordinate2DMake(restaurant.latitude, restaurant.longitude)
  • 13. App review We found that the usefulness of your Apple Watch app is limited by the minimal features it includes. Speci?cally, your Apple Watch app only launches out to Maps. ! From Apple
  • 14. There are tons of functions, but make it simple
  • 17. Usage let viewController = UIViewController() viewController.title = "Menu title" let viewControllers = [viewController] let options = PagingMenuOptions() options.menuHeight = 50 let pagingMenuController = self.childViewControllers.first as! PagingMenuController pagingMenuController.setup(viewControllers: viewControllers, options: options)