WatchKit FAQ
Check out the answers to the most commonly asked questions about WatchKit – Apple’s framework for making Apple Watch apps! By Soheil Azarpour.
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress, bookmark, personalise your learner profile and more!
Create accountAlready a member of Kodeco? Sign in
Contents
WatchKit FAQ
30 mins
- Basic Questions
- What is WatchKit and how does it work?
- What’s the difference between Xcode 6.2 beta and Xcode 6.3 beta? Which one should I use for WatchKit development?
- Can you build Apple Watch apps in Swift?
- Can I create custom watch faces?
- How many Apple Watches can I pair with one iPhone?
- Can I pair my Apple Watch with an iPad?
- Can an iPhone app wake up its WatchKit extension and watch app?
- Can third-party apps make phone calls from a watch app?
- Can you access the heartbeat sensor and other sensors on the watch from your watch app?
- What are the differences between short-look, long-look, static and dynamic notifications?
- Under The Hood
- How can I test a glance or a notification using the simulator?
- Can I position interface elements on top of each other?
- Can I customize the CALayer property of interface elements?
- Can I subclass the classes available in WatchKit?
- Can I mix page-based and navigation-based interface controllers?
- Are there equivalents for UIActivityIndicator or UIAlertController on the Apple Watch?
- Can I use Core Graphics to generate images dynamically and then use them in a watch app? Can they be cached on the watch?
- Can I use custom views in the Apple Watch? Can I customize the interface elements beyond their public API?
- How does the Apple Watch communicate with your iPhone?
- Can I use the Apple Watch while in Airplane Mode?
- What happens to my app when the Apple Watch can’t communicate with its paired iPhone?
- How can a watch app communicate with its companion iPhone app?
- How can an iPhone app communicate with its watch app?
- What happens if I don’t implement static or dynamic notification interfaces?
- What’s the difference between setImage(_:) and setImageNamed(_:)?
- Can I use iCloud in a watch App?
- Animation
- How can I add animations to my watch app?
- Can I create animations for the Apple Watch in code?
- What is the maximum animation frame rate on the Apple Watch?
- Debugging and Unit Testing
- How can I run and debug both the iPhone app and the Apple Watch app at the same time using the simulators?
- How can I unit test my WatchKit extension?
- Sharing Data
- How can you share data between a WatchKit extension and its containing iOS app?
- How can you share a Core Data database between a watch app and an iPhone app?
- Let’s Get Down to Business
- Can you make games for the Apple Watch? What kinds of games are suitable?
- How can you earn money with Apple Watch apps?
- Is there any reason to believe watch apps are a new opportunity that might let developers make a living just by developing for the App Store?
- More Questions?
Note from Ray: This is an article on WatchKit released as part of the Spring Swift Fling celebration. We hope you enjoy! :]
WatchKit has been available to developers for about three months (at the time of writing this post). As developers get to know this cool new technology, a lot of questions undoubtedly come up.
In this WatchKit FAQ, we’ll answer a bunch of frequently asked questions that we’ve seen around forums, Twitter, email and Stack Overflow. We’ll also periodically update this FAQ as new questions bubble up.
For some questions there aren’t clear solutions, so some answers are a mix of wisdom, opinion and an occasional educated guess. Just like you, we’re learning more about WatchKit as we go along, and the tech is still under heavy development and therefore subject to change.
Make sure to share your opinions and comment about what you like and don’t like in WatchKit, and ask more questions; we’ll update this FAQ based on your feedback.
Basic Questions
What is WatchKit and how does it work?
WatchKit is Apple’s framework for building hybrid apps for the Apple Watch, and it is bundled with Xcode 6.2.
WatchKit works by splitting your app into two distinct parts:
- Your Apple Watch contains just the user interface resources like the storyboard and asset catalog, and even though it handles user input it doesn’t actually execute any of the code. In other words, the Apple Watch behaves just like a thin client.
- Your iPhone contains all the code, and executes it as an extension, just like a Today or Action extension.
One cool thing is that communication between the Apple Watch and the iPhone is automatic and happens behind the scenes.
You work the way you’re used to and WatchKit handles all the wireless communication on your behalf. As far as the code you write is concerned, your views and outlets are connected locally even though they’re on a completely separate device. Pretty cool stuff!
To learn more, check out our WatchKit: Initial Impressions post.
What’s the difference between Xcode 6.2 beta and Xcode 6.3 beta? Which one should I use for WatchKit development?
If you’re planning to submit your WatchKit app the moment the App Store starts accepting them, you should use the latest Xcode 6.2 beta.
Xcode 6.3 comes with the new version of Swift – 1.2 – and according to threads in the Apple Developer Forum, Xcode 6.3 won’t be out of beta when Apple Watch is released, so you won’t be able to submit apps built with this version in time for the Apple Watch launch.
You can learn more about Xcode 6.3 and Swift 1.2 in our What’s New in Swift 1.2 post.
Can you build Apple Watch apps in Swift?
Yes, you can build apps for the Apple Watch in either Objective-C or Swift, or a combination of both. Apple has provided two sample projects for WatchKit:
- WatchKit Catalog: Using WatchKit Interface Elements – which is written entirely in Objective-C.
- Lister: A Productivity App – which comes in two flavors: Objective-C and Swift.
In addition, our WatchKit Tutorial, WatchKit video tutorial series, and WatchKit by Tutorials book are all written exclusively in Swift.
Apple has also provided the WatchKit Framework documentation in both Objective-C and Swift.
Can I create custom watch faces?
No. Custom watch faces are not currently supported.
How many Apple Watches can I pair with one iPhone?
You can pair one Apple Watch with one iPhone at a time — it’s an exclusive relationship.
Can I pair my Apple Watch with an iPad?
No. The Apple Watch only pairs with an iPhone at this time.
Can an iPhone app wake up its WatchKit extension and watch app?
No. The WatchKit extension can only ask the system to launch the companion iPhone app, which it will do so in the background. There is currently no support for this to work the other way around.
Can third-party apps make phone calls from a watch app?
No. There is no public API that lets you initiate a phone call directly from a WatchKit extension. Since the companion iPhone app can’t be brought to the foreground either, the system silently ignores all phone call or openURL:
requests from the companion iPhone app.
Can you access the heartbeat sensor and other sensors on the watch from your watch app?
No. There is currently no API to access the hardware sensors on the Apple Watch at this time.
What are the differences between short-look, long-look, static and dynamic notifications?
- Short-Look: A Short-Look notification is provided by the system. Similar to a notification banner you receive on an iPhone, you don’t have any control over a Short-Look notification. A Short-Look notification displays your app icon, app name and the title string from the notifications payload. When a notification arrives, a user sees the Short-Look notification. If the user raises their wrist, after a slight pause, the Short-Look notification will transition to the Long-Look notification.
- Long-Look: A Long-Look notification can be either Static or Dynamic.
- Static: A static notification includes a single label that is populated automatically using the notifications payload. You can create a static notification scene in your watch app’s storyboard, but can’t really customize it beyond changing the color of the sash and the title.
-
Dynamic: A dynamic notification requires you to subclass
WKUserNotificationInterfaceController
. It’s instantiated from your storyboard, and you can provide your own custom interface. Note that there are no guarantees a dynamic notification interface will be displayed. For example, if the watch’s batteries are low, the system may decide to show the static notification interface instead to preserve battery as they are less expensive to create.
- Static: A static notification includes a single label that is populated automatically using the notifications payload. You can create a static notification scene in your watch app’s storyboard, but can’t really customize it beyond changing the color of the sash and the title.
-
Dynamic: A dynamic notification requires you to subclass
WKUserNotificationInterfaceController
. It’s instantiated from your storyboard, and you can provide your own custom interface. Note that there are no guarantees a dynamic notification interface will be displayed. For example, if the watch’s batteries are low, the system may decide to show the static notification interface instead to preserve battery as they are less expensive to create.