<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/NSHostingController/init(rootView:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI19NSHostingControllerC8rootViewACyxGx_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.

---

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)