Skip to content

Enumeration

ComparisonResult

iOS 2.0+ iPadOS 2.0+ Mac Catalyst 2.0+ macOS 10.0+ tvOS 9.0+ watchOS 2.0+
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).

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.

Topics

Enumeration Cases

Initializers

Default Implementations

Relationships

Conforms To

  • Swift.BitwiseCopyable
  • Swift.Copyable
  • Swift.Decodable
  • Swift.Encodable
  • Swift.Equatable
  • Swift.Escapable
  • Swift.Hashable
  • Swift.RawRepresentable
  • Swift.Sendable
  • Swift.SendableMetatype