---
title: "init(for:content:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/remoteimmersivespace/init(for:content:)"
---

# init(for:content:)

Creates the remote immersive space for a specified type of presented data.

## Declaration

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

## Parameters

- `type`: The type of presented data this immersive space accepts.
- `content`: A compositor 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 doc://com.apple.SwiftUI/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.

## Discussion

Discussion The space uses the specified content builder to form the content. Your app invokes this initializer when it presents a value of the specified type using the openImmersiveSpace action.
