Created
February 22, 2021 11:19
-
-
Save mgratzer/171590e718ce4dccb048a98399d0fde4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension NSSortDescriptor { | |
| /// Usage: | |
| /// NSSortDescriptor( | |
| /// keyPath: \YourType.propertyName, | |
| /// ascending: false | |
| /// ) | |
| convenience init<T, U: Any>(keyPath: KeyPath<T, U>, ascending: Bool) { | |
| self.init( | |
| key: NSExpression(forKeyPath: keyPath).keyPath, | |
| ascending: ascending | |
| ) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment