Contents

snapshot(contentType:)

Captures the document’s current state for saving.

Declaration

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

Parameters

Discussion

SwiftUI calls this on the main actor when a save is needed. Keep this method lightweight — return a value that represents what to save, and perform actual serialization in write(snapshot:to:previous:progress:).

See Also

Writing a document