Contents

snapshot(contentType:)

Creates a snapshot of the document’s current state to be saved.

Declaration

@MainActor func snapshot(contentType: UTType) async throws -> sending Self.Writer.Snapshot

Parameters

  • contentType:

    The format of the data requested.

Discussion

SwiftUI calls this on the main actor when saving. Perform expensive serialization inside DocumentWriter.write(content:to:previous:progress:) rather than here.

See Also

Writing a document