<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/DocumentGroup/init(allowCreating:editor:makeDocument:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI13DocumentGroupVAA11Observation10ObservableRzAA0C0Rz10Foundation3URLV6ReaderAA08ReadableC0P_6SourceRTzAI6WriterAA08WritableC0P_11DestinationRTzrlE13allowCreating6editor04makeC0ACyxq_GSb_q_xcxAA24URLDocumentConfigurationC_AA0C15CreationContextVtYaKScMYcctcfc"
  },
  "title" : "init(allowCreating:editor:makeDocument:)"
}
-->

# init(allowCreating:editor:makeDocument:)

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

```
nonisolated init(allowCreating: Bool = true, @ContentBuilder editor: @escaping (Document) -> Content, makeDocument: @escaping @MainActor (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.

---

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)