Contents

WKApplication

The centralized point of control and coordination for apps with a single watchOS app target.

Declaration

@MainActor class WKApplication

Overview

In Xcode 13 and earlier, the system divides a watchOS app into two sections:

WatchKit app

An app bundle that contains your app icon. For storyboard-based apps, it also includes your storyboard and any assets used by the storyboard.

WatchKit extension

An extension that contains your watchOS app’s code.

In Xcode 14 and later, you can produce watchOS apps with a single watchOS app target for code, assets, extensions, and localizations. These single-target watchOS apps can run on watchOS 7 and later

Single-target watchOS apps have a single app object. While the system creates and manages this object, you can access it to perform app-level tasks such as opening URLs and getting the root interface controller of your app.

As relevant events occur within your WatchKit app, the app object notifies its delegate of those events. Your delegate object can implement the methods it needs to provide an appropriate response to life-cycle events, handle notifications, or handle Handoff–related behaviors. For more information about the methods of the delegate, see WKApplicationDelegate.

Topics

Getting the app object

Accessing the app delegate

Opening a URL resource

Getting the interface controller

Managing the app state

Managing the user interface

Managing the snapshot

Observing messages from the notification center

Registering for remote notifications

See Also

App structure