Contents

makeFileCoordinator()

Creates a file coordinator for coordinated disk access outside the normal read/write flow.

Declaration

@MainActor final func makeFileCoordinator() -> sending NSFileCoordinator

Discussion

Call this every time to get a new coordinator for each separate read or write operation. SwiftUI coordinates file access for read(from:progress:) and write(snapshot:to:previous:progress:) automatically. Use this method when you need to access the document’s file at other times — for example, to read a single sub-file of a package on demand.

Do not reuse coordinators across operations since NSFileCoordinator does not conform to Sendable.