Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

WKInterfaceMap on Apple Watch


Published on

Apple Watch meetup

Published in: Engineering
  • From A Cup To c Cup In 6 Weeks... Natural Formula ➤➤
    Are you sure you want to  Yes  No
    Your message goes here
  • Boyfriend More Responsive. I don't know how to say this, but ever since I've been using your program, I've seen my breasts grow by 1 cup size and my boyfriend seems to be a lot more affectionate towards me now! He cuddles me longer every night and buys me flowers every week. It's as if he's just been turned into a super-lover by my breast growing. I love it. ✄✄✄
    Are you sure you want to  Yes  No
    Your message goes here

WKInterfaceMap on Apple Watch

  1. 1. WKInterfaceMap on Apple Watch trippiece Inc. @kitasuke
  2. 2. Restaurant finder app in Shibuya
  3. 3. 10 things you should know about watchkit before you submit See this one as well
  4. 4. There are limitations on WKInterfaceMap at this time
  5. 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. 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. 7. Use Handoff in case it's not granted yet override init() { let type = "" let userInfo = ["actionID": 1] self.updateUserActivity(type, userInfo: userInfo, webpageURL: nil) }
  8. 8. Annotation No annotation for current location Use custom image instead
  9. 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. 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.
  11. 11. Why Realm?
  12. 12. Usage between iOS and WatchKit // Get the shared directory for the application group let id = "" 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. 13. App review We found that the usefulness of your Apple Watch app is limited by the minimal features it includes. Specifically, your Apple Watch app only launches out to Maps. — From Apple
  14. 14. There are tons of functions, but make it simple
  15. 15.  PagingMenuItem  SegmentedControl
  16. 16. 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)
  17. 17. Welcome your feedback