How To Make Your iPhone App Ready For Apple Watch: Development Tips & Tricks
WatchKit is a framework for interaction with Apple Watch and enhancing your iOS apps functionality on it.
The first and the most important feature of applications for Apple Watch is that its code is executed not on Apple Watch but on the iPhone. How does this happen? It is quite simple. Application for Apple Watch contains only the files of the user interface and the WatchKit expansion has all controllers for handling these events.
These are obligatory components of an application that requires interaction with Apple Watch. When you install an application that supports WatchKit on the iPhone, you will be prompted to install the same application on Watch (provided of course that you have Apple Watch and it is paired with the iPhone). When launching the application interface is displayed on the watch and the code is executed in background on the phone.
Currently WatchKit allows compatible applications to interact with the user interface with the help of three models:
- Actionable Notifications;
- WatchKit Apps.
Glances are the widgets that display some information, such as weather or news. You can switch gesture scroll left or right between adjacent glances, created by different applications,. Glances can be compared with the widgets tab of the “Today” from the “Notification Center» iOS. Yet, there is a significant difference: Glances are non-interactive; they cannot interact with the user. The presentation of the page is defined by offered Apple templates.
The second option is “Actionable Notifications”, which, in turn, allows you not only to view the notification, but also to respond to them, performing the offered steps. Notifications are of two types: Short Look and Long Look notifications.
Finally, “Applications, based on WatchKit” allow developers to create a user interface that runs on Apple Watch for applications running on the iPhone.
Development tips and tricks that will help you optimize your iOS app for Apple Watch:
- Gain control over WatchKit application settings with the help of settings bundle. It is analogous to iOS and can be easily found in the Apple Watch application of your iPhone;
- App groups enable you to share small volumes of data between your iOS app and WatchKit extension. If you need other resources, for example Core Data to be accessible, a share container between your iOS application and WatchKit will make an access to the data much easier and provide you with all required information;
- Creation a framework is the best solution when there is the necessity of sharing code between your iOs application and WatchKit. This framework will make your code accessible and will help you to avoid redundancy;
- WatchKit gives you an opportunity to use animation by means of outputting the required number of static images from the cache;
- Do you want to minimize traffic between iPhone and Apple Watch? A well performing WatchKit will help you to achieve this goal!
- When you manipulate table rows you don’t need to reload the entire table. Updating, adding or removing the components that had been changed will be enough;
- Sequentially named image resources enable animation on Apple Watch. Besides, you can specify a range of images to animate over a definite duration with some specific recurrence factor or reverse an animated sequence by determining the duration to a negative value;
- Handoff function provide you the possibility of moving easily between your app on Apple Watch and your app on iPhone. Use your Handoff API both in your Glance and custom notification interfaces for creating external links into your iPhone app.
Last but not least: while developing an app compatible with the Apple Watch, make sure to take care about its thorough testing. Leave your request here to be the first to get professional iOS testers with Apple Watch devices available.