One Logo Pool Ball
SwiftUI · IOS API REFERENCE

DocumentCreationSource

struct · iOS 27.0+ · SDK 27.1

struct DocumentCreationSource

Describes the source used to create a new document. 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() } }

Members (1)

init · iOS 27.0+

init

TypeScript
static init(id: string): DocumentCreationSource
Swift declaration
init(id: String)

Creates a document creation source with the given identifier. Use different sources to distinguish between document creation flows in your app. 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``. - Parameter id: A string that uniquely identifies the creation flow within your app.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUI types →