Contents

WKApplicationDelegate

A collection of methods that manages the app-level behavior for a single-target watchOS app.

Declaration

@MainActor protocol WKApplicationDelegate : NSObjectProtocol

Mentioned in

Overview

Implement the delegate’s methods to respond to your app’s life-cycle events, such as the activation and deactivation of your app. You can also implement delegate methods to respond to background tasks, Siri intents, workout sessions, or Handoff activity from another devices.

To add an app delegate, define a delegate class that subclasses NSObject and adopts the WKApplicationDelegate protocol.

import WatchKit

class MyWatchAppDelegate: NSObject, WKApplicationDelegate {

}

Then define an app delegate adaptor in your SwiftUI App structure.

import SwiftUI

@main
struct MyWatchApp_Watch_AppApp: App {
    @WKApplicationDelegateAdaptor var appDelegate: MyWatchAppDelegate
    var body: some Scene {
        WindowGroup {
            NavigationStack {
                ContentView()
            }
        }
    }
}

Finally, implement the delegate methods you want to handle.

Topics

Monitoring state changes

Responding to intents

Setup Now Playing interface

Handling a workout session

Handling background tasks

Handling extended runtime tasks

Managing remote notifications

Coordinating Handoff activity

Accepting CloudKit shares

See Also

App structure