Contents

init(_:makeFileWrapper:)

Creates a writer that converts a snapshot into a FileWrapper.

Declaration

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.

See Also

Creating a writer