---
title: "init(allowCreating:editor:makeDocument:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/documentgroup/init(allowcreating:editor:makedocument:)"
---

# init(allowCreating:editor:makeDocument:)

Creates a document group capable of creating, viewing, and editing documents.

## Declaration

```swift
nonisolated init(allowCreating: Bool = true, @ContentBuilder editor: @escaping (Document) -> Content, makeDocument: @escaping (URLDocumentConfiguration, DocumentCreationContext) async throws -> Document)
```

## Parameters

- `allowCreating`: Whether the document group supports creating new documents in addition to opening and editing existing ones.
- `editor`: The editing UI for the provided document.
- `makeDocument`: A closure that creates the document instance. Throw CancellationError to indicate that document creation was cancelled.
