Framework

WatchKit

Build apps that leverage watchOS features like background tasks, extended runtime sessions, and access to the Digital Crown.

Overview

The WatchKit framework provides the infrastructure for creating watchOS apps.

An illustration showing an Apple Watch surrounded by icons representing the features handled by the WatchKit framework, including creating user interfaces, playing background audio, or displaying custom notifications.

All watchOS apps must have an extension delegate that you can use to respond to your app’s life cycle events. You can also use the delegate to manage background tasks, extended runtime sessions, Siri intents, workout sessions, or Handoff activity from other devices.

The WatchKit framework performs other support tasks, such as accessing device-specific information about the Apple Watch running your app, registering for remote notifications, and creating custom interfaces for local and remote notifications.

Topics

Essentials

Creating an Effective watchOS Experience

Develop a complete watch experience that emphasizes brief interactions and presents the right information at exactly the right time.

Creating Independent watchOS Apps

Set up a watchOS app that installs and runs without an iOS companion app.

Building watchOS App Interfaces with SwiftUI

Create your app’s user interface by programmatically composing single-responsibility views.

Creating a watchOS App with SwiftUI

Use common SwiftUI elements and and watch-specific features in a comprehensive sample app.

App Infrastructure

Working with the watchOS App Life Cycle

Learn how the watchOS app life cycle operates and respond to life cycle notification methods.

Keeping Your watchOS Content Up to Date

Ensure that your watchOS content is relevant and up to date.

Authenticating Users on Apple Watch

Create an account sign-up and sign-in strategy for Apple Watch.

WKExtension

An object that manages behaviors shared by an app’s interface controllers.

WKExtensionDelegate

A collection of methods that manage the app-level behavior of a WatchKit extension.

WKInterfaceDevice

An object that provides information about the user’s Apple Watch.

Storyboard Support

Storyboard Elements

Connect your code to storyboard elements using interface controllers, interface objects, and event handlers.

Extended Runtime Sessions

Using Extended Runtime Sessions

Create an extended runtime session that continues running your app after the user stops interacting with it.

WKExtendedRuntimeSession

A session that continues to run your app after the user has stopped interacting.

Beta
WKExtendedRuntimeSessionErrorCode

The error codes reported by extended runtime sessions.

Beta
WKExtendedRuntimeSessionErrorDomain

The domain for errors reported by extended runtime sessions.

Beta

Background Tasks

Running watchOS Apps in the Background

Schedule and perform background tasks from within your app.

Playing Background Audio

Enable background audio in your app to provide a seamless playback experience.

Preparing to Take Your watchOS App’s Snapshot

Use snapshot background tasks to provide a timely, accurate snapshot of your app.

WKRefreshBackgroundTask

The abstract superclass for WatchKit's other background task classes.

WKApplicationRefreshBackgroundTask

A background task used to update your app’s state in the background.

WKURLSessionRefreshBackgroundTask

A background task that helps you respond to NSURLSession background transfers.

WKWatchConnectivityRefreshBackgroundTask

A background task used to receive background updates from the Watch Connectivity framework.

WKSnapshotRefreshBackgroundTask

A background task used to update your app’s user interface in preparation for a snapshot.

WKIntentDidRunRefreshBackgroundTask

A background task used to update your app after a SiriKit intent runs.

WKRelevantShortcutRefreshBackgroundTask

A background task used to periodically donate relevant Siri shortcuts.

Background Session Keys

Enable background sessions.

Notifications

Enhancing Your watchOS App with Notifications

Alert the user of significant events with notifications even when your app is not running.

Errors

WatchKitErrorCode

Error codes reported by WatchKit.

WatchKitErrorDomain

The domain for WatchKit errors. This value is used in the NSError class.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software