Sensors on Apple Watch

Now, while we've exhausted most of our sensory options on iOS, there's still plenty of room to explore on watchOS! In this section, we'll combine what we've learned about sensors in this chapter with the watchOS development we learned in the last chapter. The end goal is to get information from the Apple Watch's accelerometer, and then bring it back to iOS and display it on a chart. Let's do it!

Once again, before we start let's clear out our ViewController class to get rid of the altimeter processing that we were playing with in the last section. Your ViewController.swift file should look like this as we begin our Apple Watch experiment:

import UIKit import CoreMotion import Charts class ViewController: UIViewController { ...

Get Learning Xcode 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.