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

# init(for:content:)

Creates a data-presenting window group.

## Declaration

```swift
nonisolated init<D, C>(for type: D.Type, @ContentBuilder content: @escaping (Binding<D?>) -> C) where Content == PresentedWindowContent<D, C>, D : Decodable, D : Encodable, D : Hashable, C : View
```

## Parameters

- `type`: The type of presented data this window group accepts.
- `content`: A closure that creates the content for each instance of the group. The closure receives a binding to the value that you pass into the doc://com.apple.SwiftUI/documentation/SwiftUI/EnvironmentValues/openWindow action when you open the window. SwiftUI automatically persists and restores the value of this binding as part of the state restoration process.

## Discussion

Discussion The window group uses the given view as a template to form the content of each window in the group. SwiftUI creates a window from the group when you present a value of the specified type using the openWindow action.

## See Also

### Creating a data-driven window group

- [init(_:for:content:)](swiftui/windowgroup/init(_:for:content:).md)
