<!--
{
  "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/DocumentReader/read(from:progress:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI14DocumentReaderP4read4from8progress8SnapshotQz6SourceQzn_10Foundation11SubprogressVntYaKF"
  },
  "title" : "read(from:progress:)"
}
-->

# read(from:progress:)

Reads the document’s content from disk.

```
@concurrent func read(from source: sending Self.Source, progress: consuming Subprogress) async throws -> sending Self.Snapshot
```

## Parameters

`source`

The file URL to read from.

`progress`

A `Subprogress` value to report reading
progress. Consume it once with `reporter(totalCount:)`
and call `complete(count:)` as units finish.

## Return Value

A snapshot representing the document’s content.

## Discussion

SwiftUI calls this method in the background with
coordinated file access. Perform all deserialization and
disk access here — the returned snapshot is delivered to
[`apply(snapshot:previous:)`](/documentation/SwiftUI/ReadableDocument/apply(snapshot:previous:)) on the main
actor.

For most documents, use [`FileWrapperDocumentReader`](/documentation/SwiftUI/FileWrapperDocumentReader) instead
of implementing a custom reader. Only implement `read`
yourself when you need capabilities `FileWrapperDocumentReader`
doesn’t provide — such as direct URL access for Core Graphics,
AVFoundation, or other frameworks that operate on file paths:

```
@concurrent
func read(from source: URL, progress: consuming Subprogress)
    async throws -> sending CGImage {
    guard let imageSource =
        CGImageSourceCreateWithURL(source as CFURL, nil),
          let image = CGImageSourceCreateImageAtIndex(
              imageSource, 0, nil
          ) else {
        throw CocoaError(.fileReadCorruptFile)
    }
    return image
}
```

---

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)