---
title: WKExtension
framework: watchkit
role: symbol
role_heading: Class
path: watchkit/wkextension
---

# WKExtension

The centralized point of control and coordination for extension-based apps running in watchOS.

## Declaration

```swift
@MainActor class WKExtension
```

## Overview

Overview In Xcode 13 and earlier the system divides a watchOS app into two sections: 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 Apps with separate WatchKit app and extensions have a single extension 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 extension 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 WKExtensionDelegate.

## Topics

### Getting the extension object

- [shared()](watchkit/wkextension/shared().md)

### Accessing the extension delegate

- [delegate](watchkit/wkextension/delegate.md)
- [WKExtensionDelegate](watchkit/wkextensiondelegate.md)

### Opening a URL resource

- [openSystemURL(_:)](watchkit/wkextension/opensystemurl(_:).md)

### Getting the interface controllers

- [rootInterfaceController](watchkit/wkextension/rootinterfacecontroller.md)
- [visibleInterfaceController](watchkit/wkextension/visibleinterfacecontroller.md)

### Managing the execution state

- [applicationState](watchkit/wkextension/applicationstate.md)
- [WKApplicationState](watchkit/wkapplicationstate.md)
- [isApplicationRunningInDock](watchkit/wkextension/isapplicationrunningindock.md)
- [scheduleBackgroundRefresh(withPreferredDate:userInfo:scheduledCompletion:)](watchkit/wkextension/schedulebackgroundrefresh(withpreferreddate:userinfo:scheduledcompletion:).md)
- [isFrontmostTimeoutExtended](watchkit/wkextension/isfrontmosttimeoutextended.md)

### Managing the user interface

- [isAutorotating](watchkit/wkextension/isautorotating.md)
- [isAutorotated](watchkit/wkextension/isautorotated.md)
- [globalTintColor](watchkit/wkextension/globaltintcolor.md)
- [enableWaterLock()](watchkit/wkextension/enablewaterlock().md)

### Managing the snapshot

- [scheduleSnapshotRefresh(withPreferredDate:userInfo:scheduledCompletion:)](watchkit/wkextension/schedulesnapshotrefresh(withpreferreddate:userinfo:scheduledcompletion:).md)

### Observing messages from the notification center

- [applicationDidFinishLaunchingNotification](watchkit/wkextension/applicationdidfinishlaunchingnotification.md)
- [applicationDidBecomeActiveNotification](watchkit/wkextension/applicationdidbecomeactivenotification.md)
- [applicationWillResignActiveNotification](watchkit/wkextension/applicationwillresignactivenotification.md)
- [applicationWillEnterForegroundNotification](watchkit/wkextension/applicationwillenterforegroundnotification.md)
- [applicationDidEnterBackgroundNotification](watchkit/wkextension/applicationdidenterbackgroundnotification.md)

### Registering for remote notifications

- [registerForRemoteNotifications()](watchkit/wkextension/registerforremotenotifications().md)
- [unregisterForRemoteNotifications()](watchkit/wkextension/unregisterforremotenotifications().md)
- [isRegisteredForRemoteNotifications](watchkit/wkextension/isregisteredforremotenotifications.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [Sendable](swift/sendable.md)

## See Also

### App structure

- [Setting up a watchOS project](watchos-apps/setting-up-a-watchos-project.md)
- [WKApplication](watchkit/wkapplication.md)
- [WKApplicationDelegate](watchkit/wkapplicationdelegate.md)
- [WKExtensionDelegate](watchkit/wkextensiondelegate.md)
- [WKApplicationMain(_:_:_:)](watchkit/wkapplicationmain(_:_:_:).md)
- [WKInterfaceDevice](watchkit/wkinterfacedevice.md)
- [WKPrefersNetworkUponForeground](bundleresources/information-property-list/wkprefersnetworkuponforeground.md)
