<!--
{
  "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/FileWrapperDocumentWriter/init(_:makeFileWrapper:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI25FileWrapperDocumentWriterV_04makecD0ACyxGAA0E18WriteConfigurationVn_So06NSFileD0Cx_AISgtYaKctcfc"
  },
  "title" : "init(_:makeFileWrapper:)"
}
-->

# init(_:makeFileWrapper:)

Creates a writer that converts a snapshot into a `FileWrapper`.

```
init(_ configuration: sending FileWrapperDocumentWriter<Snapshot>.WriteConfiguration, makeFileWrapper: @escaping (Snapshot, FileWrapper?) async throws -> FileWrapper)
```

## Parameters

`configuration`

Properties required to write a document to disk.

`makeFileWrapper`

Serializes a `Snapshot` into a `FileWrapper`.
The closure takes the following parameters:

- `snapshot`: The snapshot to serialize into a `FileWrapper`.
- `previous`: The previous file wrapper that can be reused to
  optimize writing. If the latest operation for the document
  was writing, it is the file wrapper used for writing. If
  the latest operation was reading, SwiftUI passes the file
  wrapper read by a companion `FileWrapperDocumentReader`.

---

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)