---
title: WKHostingController
framework: swiftui
role: symbol
role_heading: Class
path: swiftui/wkhostingcontroller
---

# WKHostingController

A WatchKit interface controller that hosts a SwiftUI view hierarchy.

## Declaration

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

## Overview

Overview A WKHostingController presents and manages your app’s main interface using SwiftUI views. You must subclass WKHostingController and override the 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 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()](swiftui/wkhostingcontroller/init().md)

### Getting the root view

- [body](swiftui/wkhostingcontroller/body.md)

### Updating the root view

- [updateBodyIfNeeded()](swiftui/wkhostingcontroller/updatebodyifneeded().md)
- [setNeedsBodyUpdate()](swiftui/wkhostingcontroller/setneedsbodyupdate().md)

## Relationships

### Inherits From

- [WKInterfaceController](watchkit/wkinterfacecontroller.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)

## See Also

### Displaying SwiftUI views in WatchKit

- [WKUserNotificationHostingController](swiftui/wkusernotificationhostingcontroller.md)
