<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSavePanel",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSavePanel"
  },
  "title" : "NSSavePanel"
}
-->

# NSSavePanel

A panel that prompts the user for information about where to save a file.

```
@MainActor class NSSavePanel
```

## Overview

The Save panel provides an interface for specifying the location to save a file and the name of that file. You present this panel when the user attempts to save a new document, or when the user saves a copy of an existing document to a new location. The panel includes UI for browsing the file system, selecting a directory, and specifying the new name for the file. You can also add custom UI for your app using an accessory view.

An [`NSSavePanel`](/documentation/AppKit/NSSavePanel) object reports user interactions to its associated [`delegate`](/documentation/AppKit/NSSavePanel/delegate) object, which must adopt the [`NSOpenSavePanelDelegate`](/documentation/AppKit/NSOpenSavePanelDelegate) protocol. Use your delegate object to validate the user’s selection and respond to user interactions with the panel.

In macOS 10.15, the system always displays the Save dialog in a separate process, regardless of whether the app is sandboxed. When the user saves the document, macOS adds the saved file to the app’s sandbox (if necessary) so that the app can write to the file. Prior to macOS 10.15, the system used a separate process only for sandboxed apps.

## Topics

### Creating a Save Panel

[`+  savePanel`](/documentation/AppKit/NSSavePanel/savePanel)

Creates a new Save panel and initializes it with default information.

### Responding to User Interactions

[`delegate`](/documentation/AppKit/NSSavePanel/delegate)

A custom object you use to manage interactions with an open or save panel.

[`NSOpenSavePanelDelegate`](/documentation/AppKit/NSOpenSavePanelDelegate)

A set of methods for managing interactions with an open or save panel.

### Showing the Panel

[`-  beginSheetModalForWindow:completionHandler:`](/documentation/AppKit/NSSavePanel/beginSheetModal(for:completionHandler:))

Presents the panel as a sheet modal to the specified window.

[`-  beginWithCompletionHandler:`](/documentation/AppKit/NSSavePanel/begin(completionHandler:))

Presents the panel as a modeless window.

[`-  runModal`](/documentation/AppKit/NSSavePanel/runModal())

Displays the panel and begins its event loop with the current working (or last-selected) directory as the default starting point.

[`-  validateVisibleColumns`](/documentation/AppKit/NSSavePanel/validateVisibleColumns())

Validates and reloads the browser columns visible in the panel.

### Getting the Selected Item

[`URL`](/documentation/AppKit/NSSavePanel/url)

A URL that contains the fully specified location of the targeted file.

### Configuring the Panel’s Appearance

[`title`](/documentation/AppKit/NSSavePanel/title)

The title of the panel.

[`prompt`](/documentation/AppKit/NSSavePanel/prompt)

The text to display in the default button.

[`message`](/documentation/AppKit/NSSavePanel/message)

The message text displayed in the panel.

[`nameFieldLabel`](/documentation/AppKit/NSSavePanel/nameFieldLabel)

The label text displayed in front of the filename text field.

[`nameFieldStringValue`](/documentation/AppKit/NSSavePanel/nameFieldStringValue)

The user-editable filename currently shown in the name field.

[`directoryURL`](/documentation/AppKit/NSSavePanel/directoryURL)

The current directory shown in the panel.

[`accessoryView`](/documentation/AppKit/NSSavePanel/accessoryView)

The custom accessory view for the current app.

[`showsTagField`](/documentation/AppKit/NSSavePanel/showsTagField)

A Boolean value that indicates whether the panel displays the Tags field.

[`tagNames`](/documentation/AppKit/NSSavePanel/tagNames)

The tag names that you want to include on a saved file.

### Configuring the Panel’s Behavior

[`canCreateDirectories`](/documentation/AppKit/NSSavePanel/canCreateDirectories)

A Boolean value that indicates whether the panel displays UI for creating directories.

[`canSelectHiddenExtension`](/documentation/AppKit/NSSavePanel/canSelectHiddenExtension)

A Boolean value that indicates whether the panel displays UI for hiding or showing filename extensions.

[`showsHiddenFiles`](/documentation/AppKit/NSSavePanel/showsHiddenFiles)

A Boolean value that indicates whether the panel displays files that are normally hidden from the user.

[`extensionHidden`](/documentation/AppKit/NSSavePanel/isExtensionHidden)

A Boolean value that indicates whether to display filename extensions.

[`expanded`](/documentation/AppKit/NSSavePanel/isExpanded)

A Boolean value that indicates whether whether the panel is expanded.

[Button tags](/documentation/AppKit/button-tags)

Button tags that refer to items on the panel.

### Configuring the File Types

[`allowedContentTypes`](/documentation/AppKit/NSSavePanel/allowedContentTypes)

An array of types that specify the files types to which you can save.

[`allowsOtherFileTypes`](/documentation/AppKit/NSSavePanel/allowsOtherFileTypes)

A Boolean value that indicates whether the panel allows the user to save files with a filename extension that’s not in the list of allowed types.

[`treatsFilePackagesAsDirectories`](/documentation/AppKit/NSSavePanel/treatsFilePackagesAsDirectories)

A Boolean value that indicates whether the panel displays file packages as directories.

### Handling Actions

[`-  ok:`](/documentation/AppKit/NSSavePanel/ok(_:))

The action method that the panel calls when the user clicks the OK button.

[`-  cancel:`](/documentation/AppKit/NSSavePanel/cancel(_:))

The action method that the panel calls when the user clicks the Cancel button.

### Deprecated

Avoid using deprecated classes and protocols in your apps.

[Deprecated Symbols](/documentation/AppKit/nssavepanel-deprecated-symbols)

Review unsupported symbols and their replacements.

### Instance Properties

[`identifier`](/documentation/AppKit/NSSavePanel/identifier)

Sets and returns the identifier.

## Relationships

### Conforms To

[`NSStandardKeyBindingResponding`](/documentation/AppKit/NSStandardKeyBindingResponding)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

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

[`NSUserInterfaceItemIdentification`](/documentation/AppKit/NSUserInterfaceItemIdentification)

[`NSAccessibilityElementProtocol`](/documentation/AppKit/NSAccessibilityElementProtocol)

[`NSCoding`](/documentation/Foundation/NSCoding)

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

[`NSMenuItemValidation`](/documentation/AppKit/NSMenuItemValidation)

[`NSUserInterfaceValidations`](/documentation/AppKit/NSUserInterfaceValidations)

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

[`NSTouchBarProvider`](/documentation/AppKit/NSTouchBarProvider)

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

[`NSAppearanceCustomization`](/documentation/AppKit/NSAppearanceCustomization)

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

[`NSAccessibilityProtocol`](/documentation/AppKit/NSAccessibilityProtocol)

[`NSUserActivityRestoring`](/documentation/AppKit/NSUserActivityRestoring)

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

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

[`NSAnimatablePropertyContainer`](/documentation/AppKit/NSAnimatablePropertyContainer)

### Inherits From

[`NSPanel`](/documentation/AppKit/NSPanel)

### Inherited By

[`NSOpenPanel`](/documentation/AppKit/NSOpenPanel)

---

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)