The Apple Watch offers the closest connection yet between your app and users. But you can’t just port your existing iPhone app to the watch; instead, you’ll write a WatchKit Extension. Learn which of your app’s features should come to the watch, how make your UI look great on both watch sizes with WatchKit’s Interface Controller, and how to submit your app to the App Store and get it onto the wrists of your customers.
Developing for Apple Watch: Your App on Their Wrists
by Jeff Kelley
Developing for Apple Watch
Your App on Their Wrists
by Jeff Kelley
With the familiarity of Swift, Xcode, and Interface Builder, it’s tempting to think
Apple Watch is a shrunk-down iPhone, and thus straightforward to experienced
iOS developers. A few minutes playing with the SDK proves this is not the case
at all. In this essential book, Jeff Kelley gets into what’s unique and compelling
about this new platform, and where the limitations and opportunities are. I’ve
had a lot of fun getting started with it.
- Chris Adamson
Coauthor of "iOS 8 SDK Development"
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 leads you down a logical path from nothing to a
working app on the device. When I started reading the book, I didn’t even have
any ideas for what I might build, but by the end I felt almost at one with the new
device and churning with ideas. I’ll definitely be using this with my teams and to
help our strategy and business innovations.
- Kevin J. Garriott
Director, Mobile Technology, Rockfish
Jeff brings his extensive iOS knowledge to this exciting new platform in an enthusiastic
way. Jeff knows his stuff and he is willing to share his knowledge with you
as well. With his guidance you can get up and running with Apple Watch before
your order is processed and shipped.
- Janie Clayton
Coauthor of "iOS 8 SDK Development"
Apple Watch presents an exciting opportunity for iOS developers. In Developing
for Apple Watch, Jeff masterfully walks through creating your first app, providing
detailed explanations and helping you avoid common mistakes. It’s a fantastic
resource and has quickly become the guide I recommend to anyone dipping their
toes into WatchKit development.
Senior mobile developer; author of "Five Minute WatchKit, The Working Group
With how quickly mobile development moves, it can be overwhelming to stay on
top of the newest technologies, and simply figuring out where to start can be discouraging.
Jeff Kelley breaks down WatchKit in an easily digestible and pragmatic
way to get you thinking about and creating Apple Watch apps quickly and efficiently.
By the time you finish this book, you’ll not only have the knowledge necessary
to create quality watch extensions for your existing apps; you may find yourself
coming up with new app ideas for Apple Watch as well.
- Chelsey Baker
iOS and Apple Watch developer, Detroit Labs
About this Title
Release: P2.0 (2015-07-16)
With the Apple Watch, your app is right there on your user’s wrist. This book teaches you how to extend your existing 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’ll learn how to display beautiful interfaces to the user, how to use the iPhone app for heavy number-crunching, and the best way to keep everything in sync across your users’ devices. You’ll develop a watch app to take advantage of the best WatchKit has to offer, and by the end of this book, you’ll be ready to ship your own apps to the App Store.
Plus, this book will help focus your efforts. What features make sense on the watch? How should you organize them? How do you tell your users what they can do? You’ll learn how to brainstorm to come up with the best strategy for your app.
When your users are proudly showing off their Apple Watch, this book will help you make sure it’s your app on there.
Tips and Tricks from Developing for Apple Watch: Your App on Their Wrists
by Jeff Kelley
Do as little work as possible in your WatchKit Extension.
You want your WatchKit app to be fast, and one of the best ways to do that is to divide your app’s work. Let your WatchKit Extension—the part of your iPhone app that controls the UI on the watch—handle the watch UI, and offload any long-running network requests, processor-intensive computations, or database management-style tasks to your iPhone app. You’ll be able to run your iPhone app code in the background, freeing up your WatchKit Extension for handling user input and updating your interface.
A touch of color goes a long way.
The OLED screen of the Apple Watch gives you better battery life with a black background, but that doesn’t mean that your app has to be all gloom and doom. Black or dark gray backgrounds with a touch of color on the side or in text draw your users’ attention to key elements of the interface without breaking the battery bank.
Make friends with storyboards.
Every piece of user interface in your watch app must first be created in your storyboard; there’s no programmatically creating user interfaces in code. Even if you’ve grown to dislike using storyboards or xibs in iOS development, you’ll be dependent on them for WatchKit user interfaces.
Put your most timely information in your Glance.
Your WatchKit app can have only one Glance—an interface to display to your users quickly from their watch face—so make it count. It’s a place for your users to find your app’s most timely and relevant content, so be sure to give them exactly what they need.
Take advantage of system-provided internationalization.
Apple provides built-in classes to format numbers, dates, units of length, energy, and mass, and more. By using them, your app will automatically use a format that’s appropriate for your users and where they live, letting you spend more time making great apps and less time formatting data.
Test on real watch hardware.
The iOS Simulator, fantastic as it is, is not an entirely faithful reproduction of many hardware characteristics. Before sending your app to the App Store, if at all possible, run your app on a real Apple Watch. You’ll get a better sense of performance, look and feel, and integration with the rest of the watch’s features—including some things that you can’t reproduce on the simulator.
What You Need
You’ll need a Mac running Xcode 6.2 or higher, and for deploying your app to a real watch, you’ll need an Apple Watch and compatible iPhone. You’ll also need a membership in Apple’s developer program to do any on-device testing.
Contents & Extracts
- What’s in This Book?
- Who’s This Book For?
- The Code in This Book
- Online Resources
- An Overview of Apple Watch
- Apple Watch Basics
- Apple Watch App-Design Concepts
- From iPhone App to Apple Watch App
- Quick Apple Watch Wins
- Working with Media Playback on Apple Watch
- Responding to User Actions in Push Notifications
- WatchKit Extension Overview
- Creating Your First WatchKit Extension
- Adding User-Interface Elements
- The iPhone App—WatchKit Extension Relationship
- Deployment of WatchKit Apps
- Adding a Glance
- Displaying Your Watch App UI
- Meet the Interface Objects
- 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
- Delivering Dynamic Content with Tables
- 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
- Communicating with the Outside World
- Performing Tasks in Your iPhone App
- Sharing Data Between Apps
- Your App’s Final Spit and Polish
- Designing for Both Watch Sizes
- Using Images Efficiently
- Localizing and Internationalizing Your App
Jeff Kelley is an iOS developer at Detroit Labs. He’s been working with iOS since its infancy in 2008, working on award-winning apps including the Domino’s Pizza iOS ordering app and 3D Pizza Builder, the Chevy Game Time second-screen Super Bowl experience, and the DTE Energy outage center app. When not working on iOS apps, Jeff listens to an inordinate amount of podcasts and organizes the Motor City CocoaHeads group in Detroit, MI.