<!--
{
  "availability" : [
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/WKHostingController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI19WKHostingControllerC"
  },
  "title" : "WKHostingController"
}
-->

# WKHostingController

A WatchKit interface controller that hosts a SwiftUI view hierarchy.

```
@MainActor @preconcurrency class WKHostingController<Body> where Body : View
```

## Overview

A [`WKHostingController`](/documentation/SwiftUI/WKHostingController) presents and manages your app’s main interface
using SwiftUI views. You must subclass [`WKHostingController`](/documentation/SwiftUI/WKHostingController) and override
the [`body`](/documentation/SwiftUI/WKHostingController/body) property to provide the set of SwiftUI
views you want to display. Display the content of your hosting controller as
you would any other
<doc://com.apple.documentation/documentation/WatchKit/WKInterfaceController> object. For
example, you can include it as one of your app’s root interface controllers,
or present it modally.

## Topics

### Creating a hosting controller object

[`init()`](/documentation/SwiftUI/WKHostingController/init())

Creates a hosting controller object that you can use to implement your app’s main
interface using SwiftUI views

### Getting the root view

[`body`](/documentation/SwiftUI/WKHostingController/body)

The root view of the view hierarchy to display for your interface
controller.

### Updating the root view

[`updateBodyIfNeeded()`](/documentation/SwiftUI/WKHostingController/updateBodyIfNeeded())

Updates the interface controller’s set of views immediately, if updates
are pending.

[`setNeedsBodyUpdate()`](/documentation/SwiftUI/WKHostingController/setNeedsBodyUpdate())

Invalidates the current SwiftUI views and triggers an update during the
next cycle.



---

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)