---
title: "callAsFunction(at:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/opendocumentaction/callasfunction(at:)"
---

# callAsFunction(at:)

Opens the document at the specified file URL.

## Declaration

```swift
@MainActor func callAsFunction(at url: URL) async throws
```

## Parameters

- `url`: A file URL that points at an existing document.

## Discussion

Discussion Don’t call this method directly. SwiftUI calls it when you call the openDocument action: do {     try await openDocument(at: url) } catch {     // Handle error } For information about how Swift uses the callAsFunction() method to simplify call site syntax, see Methods with Special Names in The Swift Programming Language.
