<!--
{
  "availability" : [
    "macCatalyst: -",
    "macOS: 10.0.0 - 10.6.0"
  ],
  "documentType" : "symbol",
  "framework" : "ObjectiveC",
  "identifier" : "/documentation/ObjectiveC/NSObject-swift.class/panel:isValidFilename:",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Objective-C Runtime"
    ],
    "preciseIdentifier" : "c:objc(cs)NSObject(im)panel:isValidFilename:"
  },
  "title" : "panel:isValidFilename:"
}
-->

# panel:isValidFilename:

Gives the delegate the opportunity to validate selected items.

```
- (BOOL) panel:(id) sender isValidFilename:(NSString *) filename;
```

## Parameters

`sender`

Panel requesting filename validation.

`filename`

String representing the filename to validate.

## Return Value

[`YES`](/documentation/ObjectiveC/YES) if the filename is valid, or [`NO`](/documentation/ObjectiveC/NO) if the save panel should stay in its modal loop and wait for the user to type in or select a different filename or names.

## Discussion

The `NSSavePanel` object `sender` sends this message just before the end of a modal session for each filename displayed or selected (including filenames in multiple selections). If the delegate refuses a filename in a multiple selection, none of the filenames in the selection is accepted.

## See Also

  <doc://com.apple.documentation/documentation/AppKit/NSOpenSavePanelDelegate/panel(_:validate:)>



---

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)