init(_:for:contentType:prepareDocument:)
Declaration
@export(implementation) nonisolated init<D>(_ title: LocalizedStringResource, for documentType: D.Type = D.self, contentType: UTType? = nil, prepareDocument: @escaping () async throws -> D? = { nil }) where D : FileDocumentParameters
- title:
A title resource for the button.
- documentType:
A type of the document to create.
- contentType:
An optional content type of the document to create.
- prepareDocument:
A closure is called when a user presses the button. At this point, you can present a document template picker or another UI that allows users to choose a theme, configuration, or a template to create a document from. Return a prepared document, or throw an error if document creation failed. Return
nilto request creation of an empty document.