<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSApplicationDelegate/application(_:openTempFile:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSApplicationDelegate(im)application:openTempFile:"
  },
  "title" : "application(_:openTempFile:)"
}
-->

# application(_:openTempFile:)

Returns a Boolean value that indicates if the app opens the specified temporary file.

```
@MainActor optional func application(_ sender: NSApplication, openTempFile filename: String) -> Bool
```

## Parameters

`sender`

The application object associated with the delegate.

`filename`

The name of the temporary file to open.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the file was successfully opened or <doc://com.apple.documentation/documentation/Swift/false> if it was not.

## Discussion

Sent directly by `theApplication` to the delegate. The method should attempt to open the file `filename`, returning <doc://com.apple.documentation/documentation/Swift/true> if the file is successfully opened, and <doc://com.apple.documentation/documentation/Swift/false> otherwise.

By design, a file opened through this method is assumed to be temporary—it’s the application’s responsibility to remove the file at the appropriate time.

---

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)