<!--
{
  "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/URLDocumentConfiguration",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI24URLDocumentConfigurationC"
  },
  "title" : "URLDocumentConfiguration"
}
-->

# URLDocumentConfiguration

The configuration of an open document that stores its file URL,
last modification date, and related metadata.

```
@MainActor final class URLDocumentConfiguration
```

## Overview

SwiftUI passes a `URLDocumentConfiguration` to the `makeDocument`
closure of [`DocumentGroup`](/documentation/SwiftUI/DocumentGroup). This class is `@Observable` — views
and other observers can track changes to [`fileURL`](/documentation/SwiftUI/URLDocumentConfiguration/fileURL) and
other properties.

Use [`makeFileCoordinator()`](/documentation/SwiftUI/URLDocumentConfiguration/makeFileCoordinator()) to perform coordinated reads or
writes outside the normal [`DocumentReader`](/documentation/SwiftUI/DocumentReader)/[`DocumentWriter`](/documentation/SwiftUI/DocumentWriter)
flow — for example, to read a single sub-file of a package
document on demand:

```
let coordinator = configuration.makeFileCoordinator()
var error: NSError?
coordinator.coordinate(
    readingItemAt: pageURL, options: [], error: &error
) { url in
    let data = try? Data(contentsOf: url)
    // ...
}
```

> Important: Inside ``doc://com.apple.SwiftUI/documentation/SwiftUI/DocumentReader/read(from:progress:)`` and
> ``DocumentWriter/write(content:to:previous:progress:)``, use the
> `source` / `destination` URL parameter — not ``doc://com.apple.SwiftUI/documentation/SwiftUI/URLDocumentConfiguration/fileURL``. The
> configuration’s URL reflects current state and may differ from
> the operation’s URL after a Save As or rename.

## Topics

### Accessing document properties

[`fileURL`](/documentation/SwiftUI/URLDocumentConfiguration/fileURL)

A URL of the open document if it is saved to disk.

[`lastContentModificationDate`](/documentation/SwiftUI/URLDocumentConfiguration/lastContentModificationDate)

The date on which the contents of the document were last modified,
if available.

[`creationSource`](/documentation/SwiftUI/URLDocumentConfiguration/creationSource)

The source associated with the button that created this document.

### Coordinating file access

[`makeFileCoordinator()`](/documentation/SwiftUI/URLDocumentConfiguration/makeFileCoordinator())

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

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Copyable`](/documentation/Swift/Copyable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`Escapable`](/documentation/Swift/Escapable)

[`Equatable`](/documentation/Swift/Equatable)

[`Observable`](/documentation/Observation/Observable)

[`Sendable`](/documentation/Swift/Sendable)

---

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)