# 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<D, T>) -> SortKey

- `descending(_:)`

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

  #### Declaration

  Swift

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

### CoreStoreObject Key Paths

- `ascending(_:)`

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

  #### Declaration

  Swift

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

- `ascending(_:)`

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

  #### Declaration

  Swift

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

- `ascending(_:)`

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

  #### Declaration

  Swift

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

- `ascending(_:)`

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

  #### Declaration

  Swift

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

- `descending(_:)`

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

  #### Declaration

  Swift

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

- `descending(_:)`

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

  #### Declaration

  Swift

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

- `descending(_:)`

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

  #### Declaration

  Swift

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

- `descending(_:)`

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

  #### Declaration

  Swift

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

### OrderBy.SortKey where D: CoreStoreObject

- `ascending(_:)`

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

  #### Declaration

  Swift

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

- `descending(_:)`

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

  #### Declaration

  Swift

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