<!--
{
  "availability" : [
    "macOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/RemoteImmersiveSpace/init(for:content:defaultValue:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI20RemoteImmersiveSpaceV3for7content12defaultValueACyAA24CompositorContentBuilderV0K0Vy_qd__Gq_Gq_m_qd__AA7BindingVyq_Gcq_yctcAKRszAA0jK0Rd__lufc"
  },
  "title" : "init(for:content:defaultValue:)"
}
-->

# init(for:content:defaultValue:)

Creates the remote immersive space for a specified type of presented
data, and a default value, if the data is not set.

```
nonisolated init<C>(for type: Data.Type = Data.self, @CompositorContentBuilder content: @escaping (Binding<Data>) -> C, defaultValue: @escaping () -> Data) where Content == CompositorContentBuilder.Content<C>, C : CompositorContent
```

## Parameters

`type`

The type of presented data this immersive space accepts.

`content`

An immersive space content builder that defines the content
for each instance of the immersive space. The closure receives a
binding to the value that you pass to the
[`openImmersiveSpace`](/documentation/SwiftUI/EnvironmentValues/openImmersiveSpace) action when you call that
action to open an immersive space. The system automatically persists
and restores the value of this binding during state restoration.

`defaultValue`

A closure that returns a value that SwiftUI presents
when it doesn’t receive one from you, like when you call the
[`openImmersiveSpace`](/documentation/SwiftUI/EnvironmentValues/openImmersiveSpace) action without providing a
value.

## Discussion

The immersive space uses the specified content builder as a template to
form the content of the space. Your app invokes this initializer when it
presents a value of the specified `type` using the
[`openImmersiveSpace`](/documentation/SwiftUI/EnvironmentValues/openImmersiveSpace) action.

---

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)