---
title: "init(editing:migrationPlan:editor:prepareDocument:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/documentgroup/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.

## Declaration

```swift
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.

## See Also

### Editing a document backed by a persistent store

- [init(editing:contentType:editor:prepareDocument:)](swiftui/documentgroup/init(editing:contenttype:editor:preparedocument:).md)
