<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macOS: 14.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/DocumentGroup/init(editing:migrationPlan:editor:prepareDocument:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI",
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI13DocumentGroupV01_a5Data_aB0AD05ModelC0VRszrlE7editing13migrationPlan6editor07prepareC0ACyAFq_G22UniformTypeIdentifiers6UTTypeV_0aE0015SchemaMigrationI0_pXpq_ycyAO0F7ContextCctcfc"
  },
  "title" : "init(editing:migrationPlan:editor:prepareDocument:)"
}
-->

# init(editing:migrationPlan:editor:prepareDocument:)

Instantiates a document group for creating and editing documents
described by the last `Schema` in the migration plan.

```
nonisolated init(editing contentType: UTType, migrationPlan: any SchemaMigrationPlan.Type, editor: @escaping () -> Content, prepareDocument: @escaping (ModelContext) -> Void = { _ in })
```

## Parameters

`editing`

The content type of the document. It should conform to `UTType.package`.

`migrationPlan`

The description of steps required to migrate older document
versions so that they can be opened and edited.
The last `VersionedSchema` in the plan is considered to be
the current application schema.

`editor`

The editing UI for the provided document.

---

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)