<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/WritableDocument/snapshot(contentType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI16WritableDocumentP8snapshot11contentType6Writer_8SnapshotQZ07UniformG11Identifiers6UTTypeV_tYaKF"
  },
  "title" : "snapshot(contentType:)"
}
-->

# snapshot(contentType:)

Captures the document’s current state for saving.

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

## Parameters

`contentType`

The format requested (one of
[`writableContentTypes`](/documentation/SwiftUI/WritableDocument/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:)`](/documentation/SwiftUI/DocumentWriter/write(snapshot:to:previous:progress:)).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)