AILW: Beta 5 Documentation Changes

watchOS series

Today Apple rolled out Beta 5 of WatchKit. Similarly to what I did for Beta 4 here are the changes to the documentation for WatchKit for this release.

As you’d expect there are a bunch of little changes—Typos, rewordings, etc. I’m not interested in those for the purpose of this. Just material changes that will affect how I build apps.

Text in green (with an alternate background) is new.


WatchKit Programming Guide

(Guide is now available as a PDF)

WatchKit App Architecture:

Debugging Your Activation Code in iOS Simulator

During testing, you can lock and unlock the simulator to verify that your activation and deactivation code is working as expected. When you use the Hardware > Lock command to lock the simulator, WatchKit calls the didDeactivate method of the current interface controller. When you subsequently unlock the simulator, WatchKit calls the willActivate method of the interface controller.

Leveraging iOS Technologies

Remote Control Events and Now Playing Information

Apple Watch uses the remote control events system to manage the playback of audio or video on a user’s paired iPhone. The transport controls of the Now Playing glance generate remote control events for the app that is currently playing content. An iOS app that registers handlers with the commands of the MPRemoteCommandCenter object receives these events automatically when it is the “Now Playing” app. You do not need to do extra work in your WatchKit extension to support remote control events coming from Apple Watch.

NOTE: For feedback commands to like, dislike, or bookmark an item, Apple Watch uses the localizedShortTitle instead of the localizedTitle string of the MPFeedbackCommand object.

The Now Playing glance automatically displays any “Now Playing” information provided by the currently playing iOS app. An iOS app provides this information using the MPNowPlayingInfoCenter object. As your app plays its content, it should update the values of the nowPlayingInfo dictionary. Apple Watch automatically retrieves this information and displays it. In addition, tapping the track title in the Now Playing glance launches the app’s WatchKit app if one is available.

For information on how to implement support for remote control events and now playing information in your iOS app, see Remote Control Events in Event Handling Guide for iOS.

Tables

An interface controller is responsible for handling row selections in any tables it owns. When the user taps the row of a table, WatchKit selects the row and calls the table:didSelectRowAtIndex: method of the interface controller. Use that method to perform any relevant actions for your app.

(Removed the custom action method for handling table row selection)

Settings

Preferences and settings are data values that change infrequently and that you use to configure your app’s behavior or appearance. If your WatchKit app uses preferences for its configuration, you can add a WatchKit–specific settings bundle to your project to present those settings to the user. This settings bundle lives inside your containing iOS app, and the settings themselves are displayed by the Apple Watch app on the user’s iPhone….

(Entire Settings Section added view through to actual page for full details.)

Glance Essentials:

Use the system font for all text. To use custom fonts in your glance, you must render that text into an image and display the image.

Notification Essentials:

The title string used in the short look provides a brief indication of the intent of the notification. For local notifications, you specify this string using the alertTitle property of the UILocalNotification object. For remote notifications, add the title key to the alert dictionary inside the payload. For more information about adding a title string to your notifications, see Local and Remote Notification Programming Guide.

Tapping the app icon launches your WatchKit app. Tapping one of the app-defined action buttons delivers the selected action to either your iOS app or your WatchKit app. Foreground actions are delivered to your WatchKit app and extension while background actions are delivered to your iOS app. Tapping the Dismiss button closes the notification interface without any further actions. Tapping anywhere else does nothing.

Managing a Custom Long Look Interface:

The custom long look notification interface consists of two separate interfaces: one static and one dynamic. The static interface is required and is a simple way to display the notification’s alert message and any static images and text that you configure at design time. The dynamic interface is optional and gives you a way to customize the display of your notification’s content.

When you add a new notification interface controller to your storyboard file, Xcode creates only the static interface initially. You can add a dynamic interface by enabling the Has Dynamic Interface property of the notification category object in your storyboard. (Add a dynamic interface only when you require customizations that go beyond what is possible with the static interface.) Figure 16-1 shows both the unmodified static and dynamic interface scenes from a storyboard file. The static and dynamic scenes are associated with the same notification type, which you configure using the notification category object attached to the static scene.

To create a new notification interface, drag a notification interface controller object to your storyboard file. The new interface contains only the static interface controller initially. To add a dynamic interface, you must perform some additional configuration steps.

Enable the Has Dynamic Interface attribute of the notification category. This step adds the dynamic scene to your storyboard file.

Notification interfaces support only the use of the system font for labels and other text. If you need to display text in a custom font, render that text into an image and display the image.


Apple Watch Human Interface Changes

There were no significant changes to the Human Interface Guidelines.

David Smith