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

# init(_:for:content:defaultValue:)

Creates a data-presenting window group with a text view title and a default value.

## Declaration

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

## Parameters

- `title`: The doc://com.apple.SwiftUI/documentation/SwiftUI/Text view to use for the group’s title.
- `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.
- `defaultValue`: A closure that returns a default value to present. SwiftUI calls this closure when it has no data to provide, like when someone opens a new window from the File > New Window menu item.

## Discussion

Discussion The window group uses the given view as a template to form the content of each window in the group. The system uses the title to distinguish the window group in the user interface, such as in the name of commands associated with the group. important: The system ignores any text styling that you apply to the Text view title, like bold or italics. However, you can use the formatting controls that the view offers, like for localization, dates, and numerical representations. SwiftUI creates a window from the group when you present a value of the specified type using the openWindow action.

## See Also

### Providing default data to a window group

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