Skip to Content
Swift Development for the Apple Watch
book

Swift Development for the Apple Watch

by Jon Manning, Paris Buttfield-Addison
June 2016
Intermediate to advanced
85 pages
2h
English
O'Reilly Media, Inc.
Content preview from Swift Development for the Apple Watch

Chapter 2. WatchKit Apps

Put simply, a WatchKit app is an app that runs on the watch. Apps on watchOS are separate and independent binaries that run on the watch, and communicate with their parent iOS app only when they have to. This reduces latency, and ensures that the power-hungry Bluetooth radio is used as infrequently as possible.

From the user’s perspective, apps on the watch are very similar to apps on the phone: they present information to the user, and respond to taps and other input. However, while the watch is an independent computer, it’s incredibly underpowered compared to the iPhone. You can’t do heavy processing on the watch—if you need to do hard work, you get in touch with the iPhone in the user’s pocket. Additionally, certain hardware isn’t best suited to being directly in contact with the user’s skin at all times (for example, cellular radios), due to the fact that they emit larger amounts of energy.

It’s for this reason that the Apple Watch requires the user to have an iPhone: without an iPhone providing information to the watch, the watch’s utility is limited.

When you’re developing an app for the Apple Watch, you’ll end up building the iOS app and the watchOS app separately. These are two different targets in Xcode, but can belong to the same project. Any code or resource that needs to run on both devices needs to be added to both of the targets.

Displaying Content on the Watch

Once you have an empty WatchKit app, the next step is to show content:

  1. Open ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Getting Started with Apple Watch Development: Swift Programming for watchOS

Getting Started with Apple Watch Development: Swift Programming for watchOS

Ravin Sardal

Publisher Resources

ISBN: 9781491925263Errata Page