<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/WindowGroup/init(for:content:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI11WindowGroupV3for7contentACyAA09PresentedC7ContentVyqd__qd_0_GGqd__m_qd_0_AA7BindingVyqd__SgGctcAHRszSeRd__SERd__SHRd__AA4ViewRd_0_r0_lufc"
  },
  "title" : "init(for:content:)"
}
-->

# init(for:content:)

Creates a data-presenting window group.

```
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 [`openWindow`](/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

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`](/documentation/SwiftUI/EnvironmentValues/openWindow) 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)