mirror of
https://github.com/apple/swift-foundation.git
synced 2025-05-21 21:09:57 +08:00
* Port SortDescriptor and SortComparator to FoundationEssentials rdar://116408260 * Update availability
32 lines
1.3 KiB
Swift
32 lines
1.3 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2023 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#if !FOUNDATION_FRAMEWORK
|
|
|
|
/// 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).
|
|
/// Given the function:
|
|
/// ```
|
|
/// func f(a: Int, b: Int) -> ComparisonResult
|
|
/// ```
|
|
/// If:
|
|
/// `a < b` then return `.orderedAscending`. The left operand is smaller than the right operand.
|
|
/// `a > b` then return `.orderedDescending`. The left operand is greater than the right operand.
|
|
/// `a == b` then return `.orderedSame`. The operands are equal.
|
|
@frozen @available(macOS 10.0, iOS 2.0, tvOS 9.0, watchOS 2.0, *)
|
|
public enum ComparisonResult : Int, Codable, Sendable {
|
|
case orderedAscending = -1
|
|
case orderedSame = 0
|
|
case orderedDescending = 1
|
|
}
|
|
|
|
#endif // !FOUNDATION_FRAMEWORK
|