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. 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 also provides other support tasks, like accessing device-specific information about the Apple Watch running your app, registering for remote notifications, and creating custom interfaces for both 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 can install and run without an iOS companion app.

Building watchOS App Interfaces with SwiftUI

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

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 sign-in and sign-up flows that run independently on Apple Watch.

class WKExtension

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

protocol WKExtensionDelegate

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

class 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

class WKExtendedRuntimeSession

A session that gives your app additional time to run.

Beta
enum WKExtendedRuntimeSessionErrorCode

The error codes reported by extended runtime sessions.

Beta
let WKExtendedRuntimeSessionErrorDomain: String

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.

class WKRefreshBackgroundTask

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

class WKApplicationRefreshBackgroundTask

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

class WKURLSessionRefreshBackgroundTask

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

class WKWatchConnectivityRefreshBackgroundTask

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

class WKSnapshotRefreshBackgroundTask

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

class WKIntentDidRunRefreshBackgroundTask

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

class 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

struct WatchKitError

An error reported by WatchKit.

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