Apple Watch: the most convenient way to have an eye on your iPhone Apps without picking it out of your pocket every time. Which next move can become a revolution, you never know. As always Apple is trying to start a new era in the field of iOS development. They have already released the beta version of WatchKit to provide pre access to all iOS techies and kick-start the endeavor.
So I think this is the right time to have a quick look at Watch Kit essentials.
Figure1: Features of Watch Kit
Figure-1 shows the different things that can be done with the upcoming Apple Watch on the Iphone. Let us go over them one-by-one:
Watch Kit App: A launchable app from Apple watch home screen that provides a medium to view/ manipulate/ interact with your apps data.
Glance: A read-only interface used to present the most important app’s data. It is a non-scrollable single screen interface without any interactive controls which allows only one tap event to launch watch kit app.
Custom Notification: Apple watch also offers custom interface to display local / remote notifications when paired with the iPhone. You can customize these notifications by incorporating graphics, custom content and custom layout.
To run a third party app, Apple Watch needs to be paired with an iPhone and thus, before creating app for Apple Watch, one should have an iOS App created. A third party app created for Apple watch contains two separate bundles namely, WatchKit App and WatchKit Extension.
The WatchKit App can be referred to as the interface to be shown on AppleWatch whereas the WatchKit Extension contains the code that runs on the companion iPhone to handle WatchKit App’s interactions with the user.
Figure2 : The diagram shows how Watch Kit works on high level.
Creating WatchKit App:
Apple documentation says, “Creating a WatchKit App requires an existing iOS App. In the Xcode project for your iOS App, you add a new WatchKit App target, which configures the bundles and initial resources for your WatchKit App and WatchKit extension. Those bundles are then delivered as part of your iOS app on the App Store.”
So a WatchKit App can only be added as a new target to your existing iOS app. When you proceed to add a new target in Xcode, you will see a new option Apple Watch in the Xcode as shown in figure-3.
Figure3: Xcode target addition wizard
Xcode provides all the features of WatchKit discussed in figure1 when you go to next window(figure4). WatchKit App is the default and required whereas Glance and Notification are optional features that you can select now or can be created later as well.
Figure4
Xcode provides you separate schemes to test the Watch Kit App without building your main iOS app. Also you will be provided with two new executables as shown in figure5. When you build your iOS Project, it builds other executables as well and packages them together.
Figure5
Apple documentation says, “When the user installs your iOS app on an iPhone, the system prompts the user to install your WatchKit app if there is a paired Apple Watch available. The installation process is handled automatically by iOS and requires no further work on your part.”
Limitations: There are certain things that you should not entertain while developing apps for Apple Watch:
– One should not try background execution mode from WatchKit extension
– The use of technologies that seek user permissions must be avoided from WatchKit Extension
– Long running tasks must not be entertained from WatchKit extension
– It does not support native apps and you must have the iPhone paired with your watch to run 3rd party apps
To know more about Apple Watch,I recommend reading Apple Watch Programming guide.
Leave A Reply