Contents

DocumentCreationContext

Context about how a document was created.

Declaration

struct DocumentCreationContext

Overview

SwiftUI passes this to the makeDocument closure of DocumentGroup. Use creationSource to determine which NewDocumentButton the person tapped and configure the document accordingly:

DocumentGroup { document in
    EditorView(document: document)
} makeDocument: { configuration, context in
    let document = NotesDocument()
    if context.creationSource == .checklist {
        document.template = .checklist
    }
    return document
}

Topics

Accessing creation properties

See Also

Storing document data in a reference type instance