You’ve got a great idea for an Apple Watch app. But how do you get your app from idea to wrist? This book shows you how to make native watchOS apps for Apple’s most personal device yet. You’ll learn how to display beautiful interfaces to the user, how to use the watch’s heart rate monitor and other hardware features, and the best way to keep everything in sync across your users’ devices. New in this edition is coverage of native apps for watchOS 2. With the new version of the WatchKit SDK in Xcode 7, your apps run directly on the watch.
Developing for Apple Watch, Second Edition: Create Native watchOS 2 Apps with the WatchKit SDK
by Jeff Kelley
Developing for Apple Watch, Second Edition
Create Native watchOS 2 Apps with the WatchKit SDK
by Jeff Kelley
Often with a new technology, the first books are just retreads of the official docs for years until developers dig into the APIs. With Jeff Kelley having taken that step for us already by working on some of the first shipping WatchKit apps, we get a huge head start. His book is deeply rooted in hard-won lessons about what actually works on Apple Watch, and he shows how to make apps that can really shine on this new platform.
- Chris Adamson
Author of "iOS 9 SDK Development" and Software Engineer, Rev.com
This is an essential book for any iOS developer interested in getting started with WatchKit. It starts you off with a detailed summary of all of the Apple Watch features and capabilities, and then progresses along a logical path to advanced concepts and performance strategies. Working through each chapter, I started to develop several potential app and app-compliment ideas. I’ll be referring to this book often in the near future.
- Kevin J. Garriott
Director, Mobile Technology, Rockfish
Apple Watch development is new and evolving territory, and this book covers all the bases. If you want to tackle watchOS development, the information you need to fire on all pistons is right here.
- Kevin Munc
Senior iOS Developer, Method Up LLC
Get energized to develop for the Apple Watch with this book, and learn from an expert!
- Mayur S Patil
Assistant Professor, MIT Academy of Engineering, Maharashtra Academy of Engineering and Education Research, Alandi D, Pune
This book does a clear job of going through Apple Watch development in a linear fashion. It will serve as an informative reference for any developer, due to its nicely segmented topics and excellent code examples.
- Jason Humphries
Lead iOS Engineer, WedPics
This book tells you how to decide what to build for an Apple Watch and guides you through the whole development.
- Gábor László Hajba
IT Consultant, EBCONT Enterprise Technologies GmbH
About this Title
Release: P1.0 (2016-05-10)
On Apple Watch, your app is right on your users’ wrists, making your code closer than ever before. Create native watchOS apps by extending your iPhone app with a WatchKit Extension, giving your users quick access to your app’s most important features and an intimate user experience that’s always within arm’s reach.
You won’t just be creating apps—with Glances to provide timely information, notifications to inform your users of the latest updates, and watch face complications to show your users data as soon as they raise their wrists, your watchOS apps will be the best the App Store has to offer.
Any book can teach you how to make a watch app. This book will help focus your efforts and refine your app’s feature set. Which features make sense on the watch? How should you organize them? You’ll learn what to consider when judging watch app features, allowing you to come up with the best strategy for your app. You’ll test your apps on real Apple Watch hardware, and by the end of this book, you’ll be ready to ship to the App Store.
Q&A with Jeff Kelley, author of Developing for Apple Watch, Second Edition
Q: Do I need to have an Apple Watch to develop on?
A: No! Apple ships a watch simulator with Xcode, and it’s all available for free as long as you have a Mac. An Apple Watch is highly recommended for testing, but it’s not needed to go through the book.
Q: What programming language is the book in?
A: This book is in Swift, Apple’s new programming language.
Q: I know Objective-C, not Swift. Will I be able to use this book?
A: Yes! Both Objective-C and Swift code use the exact same WatchKit framework to make watch apps. The syntax is different, to be sure, but you can use Objective-C for watch apps with no problem.
Q: What will this book teach me?
A: This book covers writing watchOS apps using the WatchKit framework, creating watch face complications with the ClockKit framework, using the HealthKit framework to create health and fitness apps, and more. The focus of the book is on making watch apps.
Q: Do I need to know how to make iOS apps to read this book?
A: This book assumes that you know how to create an iOS app, but you don’t need to be an expert. As long as you’re comfortable in Xcode and understand the process of shipping an iOS app, you’ll be able to use this book. And if you’re still learning, this book will help too—aside from the watch-specific code, watchOS uses many of the same tools and frameworks as iOS.
Q: I have a great idea for a watch app, but I don’t want to make an iPhone app to go with it. Can I just put my watch app on the App Store?
A: As of iOS 9 and watchOS 2, all watch apps must be bundled inside of an iPhone app. If your app is one that only makes sense on the watch, your iPhone app can be a pretty basic shell that tells your users to install the watch app—just be sure to provide enough functionality to get approved into the App Store.
What You Need
You’ll need a Mac running OS X Yosemite capable of running Xcode 7 or later. To build your apps for your Apple Watch, you’ll need to be running watchOS 2 or later, connected to a compatible iPhone.
Contents & Extracts
- What’s in This Book?
- Who’s This Book For?
- The Code in This Book
- Online Resources
- An Overview of Apple Watch excerpt
- Apple Watch Basics
- Apple Watch App-Design Concepts
- From iPhone App to Apple Watch App
- WatchKit Extension Overview
- Creating Your First WatchKit Extension
- Adding User Interface Elements
- Adding a Glance
- The iPhone App—WatchKit Extension Relationship
- Deployment of WatchKit Apps
- WatchKit User Interfaces excerpt
- Meet WKInterfaceObject
- Creating Interface Objects
- Designing Your UI in the Storyboard
- Interface Object Layout
- Creating Your Apple Watch App
- Organizing Your UI with Groups
- Group Basics
- Adding Detail to a Screen
- Animation and Groups
- Delivering Dynamic Content with Tables excerpt
- Comparing WatchKit Tables and iOS Table Views
- Row Types and Storyboard Groups
- Linking Content to the UI with Row Controllers
- Configuring the Content in Tables
- Modifying Tables
- Considering Table Input
- Performance Concerns
- Navigating Between Interfaces
- Linking Interfaces in Your Storyboard
- Interface Transitions in Code
- Passing Data Between Interfaces
- Configuring Tracks in TapALap
- WatchKit Extension Lifecycle
- Adding Lifecycle Methods
- Adopting Handoff in the Extension Delegate
- Responding to Notifications
- Communicating with WatchConnectivity
- Making Network Requests on Apple Watch
- Preparing for WatchConnectivity: Persisting Data in TapALap
- Talking to the iPhone with WatchConnectivity
- Creating Complications with ClockKit
- Watch Faces and Complications
- Providing Complications in Your App
- Managing Complication Privacy
- Providing Placeholder Complications
- Restricting Complication Families
- Extending Complications with Time Travel
- Making Your Complication Excellent with Time Travel
- Updating Complications
- Getting Personal with Sensor Data and HealthKit
- Getting Device Motion with the CoreMotion Framework
- Working Out with HealthKit
- Unlocking Watch App Performance
- Making Apps Launch Quickly
- Increasing Performance by Removing Data
- Inspecting Performance with Instruments
- The Illusion of Performance: Preloading Data
- Being a Good Watch App Citizen
- Localizing and Internationalizing Your App
- Supporting Every User with Accessibility
Jeff Kelley has been developing iOS apps since the SDK’s release in 2008. He has developed apps for major clients, and his apps have been in the top 10 list of the App Store, featured in national television campaigns, and demonstrated by corporate executives. Jeff has spoken at conferences around the United States, and when not writing, develops apps for clients in Detroit, MI.