Chapter 15. Building a watchOS App

In Part I of this book we explored the Apple developer ecosystem and the developer tools, as well as the basics of programming with Swift and how to structure apps for Apple’s platforms. In Parts II and III, we learned the fundamentals of Swift by creating an app for both macOS and iOS, respectively; our app shares data through iCloud, lets us makes notes with a variety of attachment types, and generally behaves as a good, modern application for Mac, iPhone, or iPad. But Apple’s platforms don’t just stop at conventional computers and handheld computers—they also extend to wearable computers: Apple Watch.


It’s important to remember that you can’t build a watchOS app without also building and distributing an iOS app. watchOS apps are supplied to a tethered Apple Watch via an application users install on their iPhone.

Apple Watch runs watchOS. watchOS is quite similar to iOS in many ways, and has many of the same frameworks and basic building blocks that you’ve come to expect. In this chapter, we’ll extend our Notes app to also support the Apple Watch.


Of course, Apple also ships the Apple TV, which runs another variant of iOS called tvOS. tvOS is beyond the scope of this book, since it’s mostly targeted at entertainment apps and games, and we’re here to learn Swift through app development. Everything you’ve learned in this book about Swift, and much of the Cocoa and Cocoa Touch frameworks, applies to tvOS, too; it just has its own set ...

Get Learning Swift, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.