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

# panel:compareFilename:with:caseSensitive:

Controls the ordering of files presented by the `NSSavePanel` object specified.

```
- (NSComparisonResult) panel:(id) sender compareFilename:(NSString *) name1 with:(NSString *) name2 caseSensitive:(BOOL) caseSensitive;
```

## Parameters

`sender`

Panel requesting the ordering.

`name1`

String representing the first filename to order.

`name2`

String representing the second filename to order.

`caseSensitive`

If [`YES`](/documentation/ObjectiveC/YES), the ordering is case-sensitive; if [`NO`](/documentation/ObjectiveC/NO), it is not.

## Return Value

One of the following:

## Discussion

- `NSOrderedAscending` if `fileName1` should precede `fileName2`
- `NSOrderedSame` if the two names are equivalent
- `NSOrderedDescending` if `fileName2` should precede `fileName1`

## Discussion

Don’t reorder filenames in the Save panel without good reason, because it may confuse the user to have files in one Save panel or Open panel ordered differently than those in other such panels or in the Finder. The default behavior of Save and Open panels is to order files as they appear in the Finder. Note also that by implementing this method you will reduce the operating performance of the panel.

---

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)