<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "visionOS: 1.0.0 - 26.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/ImmersiveSpace/init(id:content:)-5keb4",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI14ImmersiveSpaceV2id7contentACyAA0cD11ViewContentVyqd__Gs5NeverOGSS_qd__yXEtcAHRszAJRs_AA0G0Rd__lufc"
  },
  "title" : "init(id:content:)"
}
-->

# init(id:content:)

Creates the immersive space associated with the specified identifier
using view-based content.

```
nonisolated init<V>(id: String, @ContentBuilder content: () -> V) where Content == ImmersiveSpaceViewContent<V>, Data == Never, V : View
```

## Parameters

`id`

A string that uniquely identifies the immersive space. Ensure
that identifiers are unique among the immersive spaces in your app.

`content`

A content builder that defines the content for each
instance of the immersive space.

## Discussion

The immersive space uses the specified view as a template to form the
content of the space.

---

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)