<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/ComparisonResult",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@E@NSComparisonResult"
  },
  "title" : "ComparisonResult"
}
-->

# ComparisonResult

Constants that indicate sort order.

```
@frozen enum ComparisonResult
```

## Overview

These constants are used to indicate how items in a request are ordered, from the first one given in a method invocation or function call to the last (that is, left to right in code).

## Topics

### Creating a comparison result

[`init(rawValue:)`](/documentation/Foundation/ComparisonResult/init(rawValue:))

### Constants

[`NSOrderedAscending`](/documentation/Foundation/ComparisonResult/orderedAscending)

The left operand is smaller than the right operand.

[`NSOrderedSame`](/documentation/Foundation/ComparisonResult/orderedSame)

The two operands are equal.

[`NSOrderedDescending`](/documentation/Foundation/ComparisonResult/orderedDescending)

The left operand is greater than the right operand.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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

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

---

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)