Last active
November 22, 2022 18:07
-
-
Save TsRebornz/a21a61fd0bbb5f3ff54bf1fecb512ca9 to your computer and use it in GitHub Desktop.
This file contains 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 Sequence { | |
func sorted<T: Comparable>(by keyPath: KeyPath<Element, T>) -> [Element] { | |
return sorted { | |
$0[keyPath: keyPath] < $1[keyPath: keyPath] | |
} | |
} | |
} | |
let sortedTables = tables.sorted(by: \.size.width) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment