# SortKey

    public struct SortKey

The `SortKey` is passed to the `OrderBy` clause to indicate the sort keys and their sort direction.

### Raw Key Paths

- `ascending(_:)`

  Indicates that the `KeyPathString` should be sorted in ascending order

  #### Declaration

  Swift

      public static func ascending(_ keyPath: KeyPathString) -> SortKey

- `descending(_:)`

  Indicates that the `KeyPathString` should be sorted in descending order

  #### Declaration

  Swift

      public static func descending(_ keyPath: KeyPathString) -> SortKey

### NSManagedObject Key Paths

- `ascending(_:)`

  Indicates that the `KeyPathString` should be sorted in ascending order

  #### Declaration

  Swift

      public static func ascending<T>(_ keyPath: KeyPath<O, T>) -> SortKey where O : NSManagedObject

- `descending(_:)`

  Indicates that the `KeyPathString` should be sorted in descending order

  #### Declaration

  Swift

      public static func descending<T>(_ keyPath: KeyPath<O, T>) -> SortKey where O : NSManagedObject

### CoreStoreObject Key Paths

- `ascending(_:)`

  Indicates that the `KeyPathString` should be sorted in ascending order

  #### Declaration

  Swift

      public static func ascending<T>(_ attribute: KeyPath<O, FieldContainer<O>.Stored<T>>) -> SortKey where O : CoreStoreObject, T : FieldStorableType

- `ascending(_:)`

  Indicates that the `KeyPathString` should be sorted in ascending order

  #### Declaration

  Swift

      public static func ascending<T>(_ attribute: KeyPath<O, ValueContainer<O>.Required<T>>) -> SortKey where O : CoreStoreObject, T : ImportableAttributeType

- `ascending(_:)`

  Indicates that the `KeyPathString` should be sorted in ascending order

  #### Declaration

  Swift

      public static func ascending<T>(_ attribute: KeyPath<O, ValueContainer<O>.Optional<T>>) -> SortKey where O : CoreStoreObject, T : ImportableAttributeType

- `ascending(_:)`

  Indicates that the `KeyPathString` should be sorted in ascending order

  #### Declaration

  Swift

      public static func ascending<T>(_ attribute: KeyPath<O, TransformableContainer<O>.Required<T>>) -> SortKey where O : CoreStoreObject, T : NSCoding, T : NSCopying

- `ascending(_:)`

  Indicates that the `KeyPathString` should be sorted in ascending order

  #### Declaration

  Swift

      public static func ascending<T>(_ attribute: KeyPath<O, TransformableContainer<O>.Optional<T>>) -> SortKey where O : CoreStoreObject, T : NSCoding, T : NSCopying

- `descending(_:)`

  Indicates that the `KeyPathString` should be sorted in descending order

  #### Declaration

  Swift

      public static func descending<T>(_ attribute: KeyPath<O, FieldContainer<O>.Stored<T>>) -> SortKey where O : CoreStoreObject, T : FieldStorableType

- `descending(_:)`

  Indicates that the `KeyPathString` should be sorted in descending order

  #### Declaration

  Swift

      public static func descending<T>(_ attribute: KeyPath<O, ValueContainer<O>.Required<T>>) -> SortKey where O : CoreStoreObject, T : ImportableAttributeType

- `descending(_:)`

  Indicates that the `KeyPathString` should be sorted in descending order

  #### Declaration

  Swift

      public static func descending<T>(_ attribute: KeyPath<O, ValueContainer<O>.Optional<T>>) -> SortKey where O : CoreStoreObject, T : ImportableAttributeType

- `descending(_:)`

  Indicates that the `KeyPathString` should be sorted in descending order

  #### Declaration

  Swift

      public static func descending<T>(_ attribute: KeyPath<O, TransformableContainer<O>.Required<T>>) -> SortKey where O : CoreStoreObject, T : NSCoding, T : NSCopying

- `descending(_:)`

  Indicates that the `KeyPathString` should be sorted in descending order

  #### Declaration

  Swift

      public static func descending<T>(_ attribute: KeyPath<O, TransformableContainer<O>.Optional<T>>) -> SortKey where O : CoreStoreObject, T : NSCoding, T : NSCopying

### Available where `O`: `CoreStoreObject`

- `ascending(_:)`

  Indicates that the `KeyPathString` should be sorted in ascending order

  #### Declaration

  Swift

      public static func ascending<K>(_ attribute: (O) -> K) -> OrderBy<O>.SortKey where K : KeyPathStringConvertible

- `descending(_:)`

  Indicates that the `KeyPathString` should be sorted in descending order

  #### Declaration

  Swift

      public static func descending<K>(_ attribute: (O) -> K) -> OrderBy<O>.SortKey where K : KeyPathStringConvertible