Introduction to watchOS 3
This article introduces all of the new and modified APIs and features available in watchOS 3 for Xamarin developers.
This document will cover the following topics:
- What's New in watchOS 3
- Apple Pay Enhancements adds support for in-app payments on the Apple Watch.
- Background Tasks give the app the ability to update its information in the background so it is ready when the user needs it.
- Complications Enhancements have been made for watchOS 3 that provide new features for the apps.
- Newly Available Frameworks have exposed for the watchOS apps.
- Proactive Suggestions allows the app to proactively show information to the user.
- Several Security and Privacy Enhancements have been made to watchOS 3.
- Snapshots and Dock provide the user with quick access to the app watchOS apps.
- User Notifications provides both local and remote notifications to the user.
- Several Watch Connectivity Framework Enhancements have been made in watchOS 3.
- Several WatchKit Framework Enhancements have been made in watchOS 3.
- Workout App Enhancements gives new abilities to the workout related Apple Watch apps.
- Additional Framework Changes have been made throughout watchOS 3.
- Deprecated APIs in watchOS 3.
What's New in watchOS 3
Apple has added several new APIs and services in watchOS 3 along with many enhancements to existing features, including:
Apple Pay Enhancements
In watchOS 3, the PassKit framework has been expanded to allow support for secure, in-app payments (of both physical goods and services) for the apps running on the Apple Watch.
Use the new PKPaymentAuthorizationController and PKPaymentAuthorizationControllerDelegate classes to present and respond to an interface where the user can authorize payment requests.
To find out more, please see our Apple Pay Enhancements guide.
Background Tasks
watchOS 3 introduces several background tasks that an app can use to update its information ensuring that it has the content the user needs before they open it.
The following new background tasks are available:
- Background App Refresh - The WKApplicationRefreshBackgroundTask task allows the app to update its state in the background. Typically this will include another task such as downloading new content from the internet using a NSUrlSession.
- Background Snapshot Refresh - The WKSnapshotRefreshBackgroundTask task allows the app to update both its content and UI before the system takes a snapshot that will be used to populate the Dock.
- Background Watch Connectivity - The WKWatchConnectivityRefreshBackgroundTask task is started for the app when it receives background data from the paired iPhone.
- Background URL Session - The WKURLSessionRefreshBackgroundTask task is started for the app when a background transfer requires authorization or completes (successfully or in error).
To find out more, please see our Background Tasks guide.
Complications Enhancements
Complications are small visual elements that provide useful information at a glance. Depending on the watch face selected, the user has the ability to customize a watch face with one or more Complication.
watchOS 3 gives the app the ability to create one or more Complication for the watch app so that the user can access its information at-a-glance from a watch face.
Additionally, Complications provide the following benefits:
- The user can quickly launch the app by tapping on the Complication directly from a watch face.
- Having one of the app's Complications on the watch face causes the system to keep the app in a ready-to-launch state where it attempts to launch the app in the background, keep it in memory and gives it extra time to update.
- Complications are guaranteed at least 50 push updates per day.
- When the app includes Complications, it will be featured in the Apple Watch Face Gallery.
In watchOS 3, the ClockKit framework now includes several new templates for extra large complications such as CLKComplicationTemplateExtraLargeColumnsText and CLKComplicationTemplateExtraLargeRingImage. Additionally, to create localizable text, use new methods of the CLKTextProvider class.
To find out more, please see our Quick Interaction Techniques for watchOS 3 guide.
Newly Available Frameworks
watchOS 3 includes several existing Apple frameworks that were previously unavailable such as:
- SceneKit - Use SceneKit to include 3D models into the watch app's UI including most of the features available on other platforms like lighting, shading, animation, physics and particle systems. 3D spatial audio, custom Metal or OpenGL shaders, Core Image Filters and physically-based materials are not supported.
- SpriteKit - Use SpriteKit to render and animate sprites in the app watch app's UI including most of the features available on other platforms like actions, physics, lighting and particle systems. 3D spatial audio, video playback and Core Image Filters are not supported.
- AVFoundation - To manage and play audio.
- CloudKit - To move data between the watch app and iCloud containers.
- Core Audio - To manage data types for representing audio streams, complex buffers and time values.
- GameKit - To create social games.
Proactive Suggestions
watchOS 3 allows the app to proactively present information to the user within given contexts. To support this feature, the NSUserActivity now includes the MapItem
property that lets the app provide location information for later use by other apps.
To find out more, please see our Introduction to Proactive Suggestions guide.
Security and Privacy Enhancements
Apple has made several enhancements to both security and privacy in watchOS 3 that will help the developer improve the security of their apps and ensure the end user's privacy.
As a result, apps running on watchOS 3 (or later) must statically declare their intent to access specific features or user information by entering one or more Privacy Specific Keys in their Info.plist
files that explain to the user why the app wishes to gain access.
Since watchOS 3 shares these changes with iOS 10, please see our iOS 10 Security and Privacy Enhancements guide for more information.
Snapshots and Dock
In watchOS 3, Apple has added the Dock where users can pin their favorite apps and quickly access them. When the user presses the Side Button on the Apple Watch, a gallery of pinned app snapshots will be displayed. The user can swipe left or right to find the desired app, then tap the app to launch it replacing the snapshot with the running app's interface.
The system periodically takes snapshots of the app's UI and uses those snapshots to populate the Docs. watchOS gives the app the opportunity to update its content and UI before this snapshot is taken.
For more information, please see our Background Tasks guide and Apple's WKSnapshotRefreshBackgroundTask Reference .
User Notifications
The User Notification framework introduced in watchOS 3 supports the delivery of both local and remote notifications to the Apple Watch. Use this framework to schedule notifications based on specific conditions such as time of day or location and to receive and handle notifications.
To find out more, please see our Quick Interaction Techniques for watchOS 3 guide.
Watch Connectivity Framework Enhancements
The new HasContentPending
property of the WCSession class indicates that the session has received data in the background that needs to be processed. And the RemainingComplicationUserInfoTransfers
property returns the remaining times that the iOS app can update its watchOS Complication.
To find out more, please see our Background Tasks guide.
WatchKit Framework Enhancements
watchOS 3 includes several enhancements to the WatchKit framework including the following:
- The app can get the state of the Digital Crown using the new WKCrownSequencer class and receive updates when the user rotates the crown using the WKCrownDelegate class.
- The WKExtension class now includes the
ApplicationState
method and WKApplicationState constant that the app can use to track the runtime state of the app.WKExtension
also provides two new methods that can be used to schedule background tasks. - The WKExtensionDelegate now includes the new
ApplicationWillEnterForeground
,ApplicationDidEnterBackground
andHandleBackgroundTasks
methods to monitor changes in the app's state and handle background task updates. - A new WKGestureRecognizer class has been added to provide the following types of gesture recognition to the watch apps: WKLongPressGestureRecognizer, WKPanGestureRecognizer, WKSwipeGestureRecognizer and WKTapGestureRecognizer.
- The new WKinterfaceHMCamera class provides an interface for any HomeKit attached IP camera.
- The new WKInterfaceInlineMovie class allows the app to display a movie "poster" that is replaced by the running movie when the user taps it.
- The new WKInterfacePaymentButton class allows the app to present an Apple Pay button in its UI that will initiate a payment request when tapped.
- The new WKInterfaceSCNScene class presents an interface for displaying a SceneKit scene on the Apple Watch.
- The new WKInterfaceSKScene class presents an interface for displaying a SpriteKit scene on the Apple Watch.
To find out more, please see our Quick Interaction Techniques for watchOS 3 guide.
Workout App Enhancements
New to watchOS 3, workout related apps have the ability to run in the background on the Apple Watch. To enable this feature (and gain access to HealthKit data), the app must include the WKBackgroundModes
key in the Info.plist
file with the value workout-processing
.
Additionally, the developer now has the ability to launch the watchOS workout app from the iOS app version on the paired iPhone.
To find out more, please see our Workout App Enhancements guide.
Additional Framework Changes
In addition to the major framework changes and additions listed above, Apple has made many additional minor framework changes in watchOS 3.
To find out more, please see our Additional Framework Changes guide.
Deprecated APIs
The following APIs have been deprecated in watchOS 3:
- The
UILocalNotification
class of UIKit has been deprecated and should be replaced with the User Notification framework.
See Apple's watchOS 2.2 to watchOS 3.0 API Differences documentation for a complete list of deprecations and changes.