DocumentCreationSource
Describes the source used to create a new document.
Declaration
struct DocumentCreationSourceOverview
On iOS, you can declare custom creation sources and use them in NewDocumentButton.
extension DocumentCreationSource {
static let scanner: Self =
DocumentCreationSource(id: "document-from-scanner")
static let template: Self =
DocumentCreationSource(id: "document-from-template")
}
DocumentGroupLaunchScene("Documents") {
NewDocumentButton("Scan Document", source: .scanner)
NewDocumentButton("New from Template", source: .template)
}When a document is created, you can retrieve its source from URLDocumentConfiguration or FileDocumentConfiguration:
DocumentGroup(newDocument: { MyDocument() }) { configuration in
if configuration.creationSource == .template {
TemplateSetupView()
}
}