<!--
{
  "availability" : [
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WatchKit",
  "identifier" : "/documentation/WatchKit/WKInterfaceController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "WatchKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKInterfaceController"
  },
  "title" : "WKInterfaceController"
}
-->

# WKInterfaceController

A class that provides the infrastructure for managing the interface in a watchOS app.

```
@MainActor class WKInterfaceController
```

## Overview

An interface controller serves the same purpose as a <doc://com.apple.documentation/documentation/UIKit/UIViewController> object in a UIKit app, except that it doesn’t manage any actual views. It runs in your WatchKit extension and remotely manages the behavior associated with an interface controller in your Watch app’s storyboard file. You subclass [`WKInterfaceController`](/documentation/WatchKit/WKInterfaceController) and use its methods to configure the elements of your storyboard scene and to respond to interactions with those elements.

Your interface controller code runs locally on the user’s Apple Watch but is separate from the interface that it manages. When you change the value of an interface object in your code, the system forwards the needed information to your Watch app, which makes the corresponding changes onscreen.

### Initialize your interface controllers

When the user interacts with your app content, the system launches your extension and creates the appropriate interface controller objects automatically. Apps use different interface controllers to manage their notification and app interfaces; WatchKit uses the information in your app’s main storyboard file to determine which interface controller to load. Notification scenes are configured specially so that the system can identify them. For your app, WatchKit loads your app’s main interface controller initially, but you may change the initial interface controller at launch time.

When creating an interface controller, WatchKit instantiates the class and calls its [`init()`](/documentation/WatchKit/WKInterfaceController/init()) method. You can use this method to initialize variables and load data; however, don’t use it to configure your user interface. The controller’s user interface elements may not be properly initialized when this method runs.

Next, the system calls the [`awake(withContext:)`](/documentation/WatchKit/WKInterfaceController/awake(withContext:)) method. If WatchKit passes a valid object to the [`awake(withContext:)`](/documentation/WatchKit/WKInterfaceController/awake(withContext:)) method, use the information in that object to customize the initialization process. Also, the controller’s user interface elements are guaranteed to be available at this point. This means that you can safely use this method to configure your user interface.

The [`willActivate()`](/documentation/WatchKit/WKInterfaceController/willActivate()) method lets you know when your interface is about to become active. Use the [`willActivate()`](/documentation/WatchKit/WKInterfaceController/willActivate()) method to perform any last minute tasks, such as checking for updates to your content; however, don’t use it for your primary initialization.

The [`willActivate()`](/documentation/WatchKit/WKInterfaceController/willActivate()) method may be called at times when your interface isn’t yet onscreen. For example, WatchKit may call the method in advance so that you have time to update your content. WatchKit calls the [`didAppear()`](/documentation/WatchKit/WKInterfaceController/didAppear()) method to let you know when your interface becomes visible. Similarly, WatchKit calls the [`willDisappear()`](/documentation/WatchKit/WKInterfaceController/willDisappear()) and [`didDeactivate()`](/documentation/WatchKit/WKInterfaceController/didDeactivate()) methods when your interface moves offscreen again.

> Important:
> An interface controller can make changes to its interface only in the ``doc://com.apple.watchkit/documentation/WatchKit/WKInterfaceController/awake(withContext:)`` method, in the ``doc://com.apple.watchkit/documentation/WatchKit/WKInterfaceController/willActivate()`` method, and while the interface is active. Once the system calls the ``doc://com.apple.watchkit/documentation/WatchKit/WKInterfaceController/didDeactivate()`` method, it ignores any attempts to change the value of the controller’s interface objects until the system calls the interface controller’s ``doc://com.apple.watchkit/documentation/WatchKit/WKInterfaceController/willActivate()`` method again.

In iOS Simulator, WatchKit calls the [`didDeactivate()`](/documentation/WatchKit/WKInterfaceController/didDeactivate()) method for the current interface controller when you lock the simulator by selecting Hardware > Lock. When you subsequently unlock the simulator, WatchKit calls that interface controller’s [`willActivate()`](/documentation/WatchKit/WKInterfaceController/willActivate()) method again. You can use this capability to debug your activation and deactivation code.

### Interface Builder configuration options

Xcode lets you configure information about your interface controller in your storyboard file. The following table lists the attributes you can configure in your storyboard and their meaning.

|Attribute                 |Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
|--------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|Identifier                |The name of the interface controller. Use this name to specify which interface controller to push or present.                                                                                                                                                                                                                                                                                                                                                                                                         |
|Title                     |The title string assigned to the interface controller. You can set this value programmatically using the ``doc://com.apple.watchkit/documentation/WatchKit/WKInterfaceController/setTitle(_:)`` method.                                                                                                                                                                                                                                                                                                               |
|Is Initial Controller     |A Boolean indicating whether the object is the app’s root interface controller. Only one interface controller at a time may have this option enabled. This option doesn’t apply to glance or notification interface controllers.                                                                                                                                                                                                                                                                                      |
|Activity Indicator On Load|A Boolean value that indicates whether the interface controller’s contents are hidden until the ``doc://com.apple.watchkit/documentation/WatchKit/WKInterfaceController/willActivate()`` method returns. When you enable this option, the system displays a progress indicator until the ``doc://com.apple.watchkit/documentation/WatchKit/WKInterfaceController/willActivate()`` method returns. You might disable this option if your interface contains mostly static information that can be displayed right away.|
|Always Bounce             |A Boolean value that turns off scrolling and allows built-in controls and containers to fill content to the screen edges, regardless of the content-safe area.                                                                                                                                                                                                                                                                                                                                                        |
|Full Screen               |A Boolean value that determines whether SpriteKit or SceneKit content can use the full screen. The system hides the status bar but displays the time in the upper-right corner with a gradient behind it, making the time clearly visible against the scene.                                                                                                                                                                                                                                                          |
|Fixed to screen edges     |A Boolean value that indicates whether the contents ignore the safe area and minimum layout margins. When you enable this option, the system turns off scrolling, and allows built-in controls and containers to fill content to the screen edges.                                                                                                                                                                                                                                                                    |
|Background                |The background image displayed behind the scene’s content. The image specified in your storyboard scrolls with your interface controller’s content.                                                                                                                                                                                                                                                                                                                                                                   |
|Mode                      |The content mode for the background image. This mode defines how the background image scales or fills the screen and behaves in the same way as the constants for the <doc://com.apple.documentation/documentation/UIKit/UIView/ContentMode-swift.enum> type.                                                                                                                                                                                                                                                         |
|Animate                   |A Boolean value indicating whether an animated background image starts running its animation automatically after being loaded. Set this option to `Yes` if you want the animation to start automatically; set it to `No` if you prefer to start the animation programmatically.                                                                                                                                                                                                                                       |
|Color                     |The background color to be displayed behind the scene’s content.                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
|Insets                    |The amount of space (in points) to insert between the edges of the interface controller and its content. Select Custom to specify different values for the top, bottom, left, and right edges.                                                                                                                                                                                                                                                                                                                        |
|Spacing                   |Additional spacing (in points) to include between items in the interface controller.                                                                                                                                                                                                                                                                                                                                                                                                                                  |

### Subclassing notes

Subclass `WKInterfaceController` when you have a storyboard scene that requires configuration at runtime or that handles user interactions. Typically, you define a custom subclass for each unique storyboard scene that your app manages. In your subclass, define outlets for any interface objects you need to configure and define action methods for responding to interactions with the elements of your storyboard scene.

Most custom interface controllers you use in your app require a custom interface controller subclass. Even glances need an interface controller to update the glance contents. The only storyboard scene that can’t use a custom interface controller is the scene associated with a static notification interface. When implementing an interface controller for your dynamic notification interface, subclass [`WKUserNotificationInterfaceController`](/documentation/WatchKit/WKUserNotificationInterfaceController) instead.

Override any methods of the class needed to configure your interface and get it ready to display. Most interface controllers override the [`init()`](/documentation/WatchKit/WKInterfaceController/init()) and [`awake(withContext:)`](/documentation/WatchKit/WKInterfaceController/awake(withContext:)) methods. Override any other methods that make sense based on your needs.

## Topics

### Creating the interface controller

[`-  init`](/documentation/WatchKit/WKInterfaceController/init())

Returns an initialized interface controller object.

[`-  awakeWithContext:`](/documentation/WatchKit/WKInterfaceController/awake(withContext:))

Initializes the interface controller with the specified context data.

[`-  setTitle:`](/documentation/WatchKit/WKInterfaceController/setTitle(_:))

Sets the title of the interface.

### Responding to activation and appearance events

[`-  willActivate`](/documentation/WatchKit/WKInterfaceController/willActivate())

Tells the interface controller that the system is about to activate its view.

[`-  didDeactivate`](/documentation/WatchKit/WKInterfaceController/didDeactivate())

Tells the interface controller that its view is no longer active.

[`-  didAppear`](/documentation/WatchKit/WKInterfaceController/didAppear())

Tells the interface controller that its view is now onscreen.

[`-  willDisappear`](/documentation/WatchKit/WKInterfaceController/willDisappear())

Tells the interface controller that its view is now offscreen.

### Implementing a navigation interface

[`-  pushControllerWithName:context:`](/documentation/WatchKit/WKInterfaceController/pushController(withName:context:))

Pushes a new interface controller onto the screen.

[`-  popController`](/documentation/WatchKit/WKInterfaceController/pop())

Pops the current interface controller from the screen.

[`-  popToRootController`](/documentation/WatchKit/WKInterfaceController/popToRootController())

Pops all interface controllers except the app’s initial interface controller.

### Presenting interface controllers modally

[`-  presentControllerWithName:context:`](/documentation/WatchKit/WKInterfaceController/presentController(withName:context:))

Presents a single interface controller modally.

[`-  presentControllerWithNames:contexts:`](/documentation/WatchKit/WKInterfaceController/presentController(withNames:contexts:))

Presents a page-based interface modally.

[`presentController(withNamesAndContexts:)`](/documentation/WatchKit/WKInterfaceController/presentController(withNamesAndContexts:))

Presents a page-based interface modally.

[`-  presentAlertControllerWithTitle:message:preferredStyle:actions:`](/documentation/WatchKit/WKInterfaceController/presentAlert(withTitle:message:preferredStyle:actions:))

Presents an alert or action sheet over the current interface controller.

[`WKAlertControllerStyle`](/documentation/WatchKit/WKAlertControllerStyle)

Constants indicating the styles for standard system alerts.

[`-  dismissController`](/documentation/WatchKit/WKInterfaceController/dismiss())

Dismisses the current interface controller from the screen.

### Navigating a page-based interface

[`+  reloadRootPageControllersWithNames:contexts:orientation:pageIndex:`](/documentation/WatchKit/WKInterfaceController/reloadRootPageControllers(withNames:contexts:orientation:pageIndex:))

Loads the specified interface controllers and rebuilds the app’s page-based interface for the given scrolling orientation.

[`WKPageOrientation`](/documentation/WatchKit/WKPageOrientation)

Scrolling orientations for page-based interfaces.

[`reloadRootControllers(withNamesAndContexts:)`](/documentation/WatchKit/WKInterfaceController/reloadRootControllers(withNamesAndContexts:))

Loads the specified interface controllers and rebuilds the app’s page-based interface.

[`-  becomeCurrentPage`](/documentation/WatchKit/WKInterfaceController/becomeCurrentPage())

Displays the interface controller in the page-based interface.

### Managing segue-based transitions

[`-  contextForSegueWithIdentifier:`](/documentation/WatchKit/WKInterfaceController/contextForSegue(withIdentifier:))

Returns the context object to pass to the specified interface controller when a button is tapped.

[`-  contextsForSegueWithIdentifier:`](/documentation/WatchKit/WKInterfaceController/contextsForSegue(withIdentifier:))

Returns the context objects to pass to a page-based set of interface controllers when a button is tapped.

[`-  contextForSegueWithIdentifier:inTable:rowIndex:`](/documentation/WatchKit/WKInterfaceController/contextForSegue(withIdentifier:in:rowIndex:))

Returns the context object to pass to the specified interface controller when a row in a table is tapped.

[`-  contextsForSegueWithIdentifier:inTable:rowIndex:`](/documentation/WatchKit/WKInterfaceController/contextsForSegue(withIdentifier:in:rowIndex:))

Returns the context objects to pass to a page-based set of interface controllers when a row in a table is tapped.

### Managing Scrolling

[`-  scrollToObject:atScrollPosition:animated:`](/documentation/WatchKit/WKInterfaceController/scroll(to:at:animated:))

Scrolls the specified object to the given position onscreen.

[`WKInterfaceScrollPosition`](/documentation/WatchKit/WKInterfaceScrollPosition)

Onscreen scroll positions.

[`-  interfaceDidScrollToTop`](/documentation/WatchKit/WKInterfaceController/interfaceDidScrollToTop())

Tells the interface controller that the user has performed a scroll-to-top gesture (for example, tapping the status bar) and that the scrolling animation has finished.

[`-  interfaceOffsetDidScrollToTop`](/documentation/WatchKit/WKInterfaceController/interfaceOffsetDidScrollToTop())

Tells the interface controller that the user has scrolled to the top of the interface and that the scrolling animation has finished.

[`-  interfaceOffsetDidScrollToBottom`](/documentation/WatchKit/WKInterfaceController/interfaceOffsetDidScrollToBottom())

Tells the interface controller that the user has scrolled to the bottom of the interface and that the scrolling animation has finished.

[`tableScrollingHapticFeedbackEnabled`](/documentation/WatchKit/WKInterfaceController/isTableScrollingHapticFeedbackEnabled)

A Boolean value that determines whether haptic feedback coordinates with the appearance of new rows as the user scrolls through a table.

### Respecting safe areas and layout margins

[`contentSafeAreaInsets`](/documentation/WatchKit/WKInterfaceController/contentSafeAreaInsets)

Insets that define the area where it’s safe to display content on the screen.

[`systemMinimumLayoutMargins`](/documentation/WatchKit/WKInterfaceController/systemMinimumLayoutMargins)

Leading and trailing insets that represent the minimum layout margins for text elements.

[`contentFrame`](/documentation/WatchKit/WKInterfaceController/contentFrame)

The frame rectangle used to display your app’s content.

### Animating changes to the interface

[`-  animateWithDuration:animations:`](/documentation/WatchKit/WKInterfaceController/animate(withDuration:animations:))

Animates changes to one or more interface objects over the specified duration.

### Handling text input

[`-  presentTextInputControllerWithSuggestions:allowedInputMode:completion:`](/documentation/WatchKit/WKInterfaceController/presentTextInputController(withSuggestions:allowedInputMode:completion:))

Displays a modal interface for gathering text input from the user.

[`-  presentTextInputControllerWithSuggestionsForLanguage:allowedInputMode:completion:`](/documentation/WatchKit/WKInterfaceController/presentTextInputControllerWithSuggestions(forLanguage:allowedInputMode:completion:))

Displays a modal interface for gathering language-specific text input from the user.

[`-  dismissTextInputController`](/documentation/WatchKit/WKInterfaceController/dismissTextInputController())

Dismisses the text input controller without returning any text.

[`WKTextInputMode`](/documentation/WatchKit/WKTextInputMode)

The input modes supported by the text input controller.

### Presenting video and audio interfaces

[`-  presentMediaPlayerControllerWithURL:options:completion:`](/documentation/WatchKit/WKInterfaceController/presentMediaPlayerController(with:options:completion:))

Displays a modal interface for playing the specified media file.

[Media Player Options](/documentation/WatchKit/media-player-options)

Keys indicating media playback options.

[`-  dismissMediaPlayerController`](/documentation/WatchKit/WKInterfaceController/dismissMediaPlayerController())

Dismisses the media interface controller.

[`-  presentAudioRecorderControllerWithOutputURL:preset:options:completion:`](/documentation/WatchKit/WKInterfaceController/presentAudioRecorderController(withOutputURL:preset:options:completion:))

Display a standard interface for recording audio from the user’s Apple Watch.

[`WKAudioRecorderPreset`](/documentation/WatchKit/WKAudioRecorderPreset)

Constants indicating the quality of audio recordings.

[Audio Recording Options](/documentation/WatchKit/audio-recording-options)

Options to specify when recording audio.

[`-  dismissAudioRecorderController`](/documentation/WatchKit/WKInterfaceController/dismissAudioRecorderController())

Dismisses the audio recording interface controller.

### Handling table-row selections

[`-  table:didSelectRowAtIndex:`](/documentation/WatchKit/WKInterfaceController/table(_:didSelectRowAt:))

Called to let you know that the user selected a row in the table.

### Managing pickers

[`-  pickerDidFocus:`](/documentation/WatchKit/WKInterfaceController/pickerDidFocus(_:))

Called to let you know that the specified picker is now receiving input from the Digital Crown.

[`-  pickerDidResignFocus:`](/documentation/WatchKit/WKInterfaceController/pickerDidResignFocus(_:))

Called to let you know that the specified picker is no longer receiving input from the Digital Crown.

[`-  pickerDidSettle:`](/documentation/WatchKit/WKInterfaceController/pickerDidSettle(_:))

Called to let you know when the user settles on a value in a picker.

### Getting the crown sequencer

[`crownSequencer`](/documentation/WatchKit/WKInterfaceController/crownSequencer)

The object to use when directly tracking crown events.

### Coordinating Handoff activity

[`-  updateUserActivity:`](/documentation/WatchKit/WKInterfaceController/update(_:))

Registers the current user activity with the system.

[`-  invalidateUserActivity`](/documentation/WatchKit/WKInterfaceController/invalidateUserActivity())

Invalidates the most recent user activity.

### Adding PassKit passes

[`-  presentAddPassesControllerWithPasses:completion:`](/documentation/WatchKit/WKInterfaceController/presentAddPassesController(withPasses:completion:))

Displays a modal interface for presenting passes to the user.

[`-  dismissAddPassesController`](/documentation/WatchKit/WKInterfaceController/dismissAddPassesController())

Dismisses the pass interface controller

### Managing Notifications

[`WKAccessibilityVoiceOverStatusChanged`](/documentation/WatchKit/WKAccessibilityVoiceOverStatusChanged)

Tells the interface controller that the VoiceOver status has changed.

[`WKAccessibilityReduceMotionStatusDidChangeNotification`](/documentation/WatchKit/WKAccessibilityReduceMotionStatusDidChangeNotification)

Tells the interface controller that the reduce motion status has changed.

### Deprecated symbols

[Text Response Key](/documentation/WatchKit/text-response-key)

Keys for retrieving text response information.

[`-  addMenuItemWithImageNamed:title:action:`](/documentation/WatchKit/WKInterfaceController/addMenuItem(withImageNamed:title:action:))

Adds an action to the context menu using an existing image resource in your Watch app bundle.

[`-  addMenuItemWithItemIcon:title:action:`](/documentation/WatchKit/WKInterfaceController/addMenuItem(with:title:action:)-6pb4t)

Adds an action to the context menu using a system-provided icon.

[`-  addMenuItemWithImage:title:action:`](/documentation/WatchKit/WKInterfaceController/addMenuItem(with:title:action:)-1q2zj)

Adds an action to the context menu by using an image provided by your WatchKit extension.

[`-  beginGlanceUpdates`](/documentation/WatchKit/WKInterfaceController/beginGlanceUpdates())

Tells the system that you are about to start a potentially lengthy update task for your glance.

[`-  clearAllMenuItems`](/documentation/WatchKit/WKInterfaceController/clearAllMenuItems())

Removes all programmatically added actions from the context menu.

[`-  endGlanceUpdates`](/documentation/WatchKit/WKInterfaceController/endGlanceUpdates())

Tells the system that you finished updating your glance content.

[`-  handleUserActivity:`](/documentation/WatchKit/WKInterfaceController/handleUserActivity(_:))

Responds to Handoff–related activity.

[`presentController(_:)`](/documentation/WatchKit/WKInterfaceController/presentController(_:))

Presents a page-based interface modally.

[`+  reloadRootControllersWithNames:contexts:`](/documentation/WatchKit/WKInterfaceController/reloadRootControllers(withNames:contexts:))

Loads the specified interface controllers and rebuilds the app’s page-based interface.

[`-  updateUserActivity:userInfo:webpageURL:`](/documentation/WatchKit/WKInterfaceController/updateUserActivity(_:userInfo:webpageURL:))

Registers the current user activity with the system.

[`WKMenuItemIcon`](/documentation/WatchKit/WKMenuItemIcon)

Template images that you can use for menus.

## Relationships

### Conforms To

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Equatable`](/documentation/Swift/Equatable)

[`Sendable`](/documentation/Swift/Sendable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

### Inherited By

[`WKUserNotificationInterfaceController`](/documentation/WatchKit/WKUserNotificationInterfaceController)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)