<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/UIHostingController/init(rootView:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI19UIHostingControllerC8rootViewACyxGx_tcfc"
  },
  "title" : "init(rootView:)"
}
-->

# init(rootView:)

Creates a hosting controller object that wraps the specified SwiftUI
view.

```
@MainActor @preconcurrency init(rootView: Content)
```

## Parameters

`rootView`

The root view of the SwiftUI view hierarchy that
you want to manage using the hosting view controller.

## Return Value

A `UIHostingController` object initialized with the
specified SwiftUI view.

---

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)