snapshot(contentType:)
Captures the document’s current state for saving.
Declaration
@MainActor func snapshot(contentType: UTType) async throws -> sending Self.Writer.SnapshotParameters
- contentType:
The format requested (one of Writablecontenttypes).
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:).