> 27 Aug. 2016 15:58 Charlie Monroe via swift-evolution
> <[email protected]> wrote:
> Now, you need to do:
>
> users.sorted({
> guard let firstName = $0.0.lastName else {
> return true
> }
>
> guard let secondName = $0.1.lastName else {
> return false
> }
>
> return firstName < secondName
> })
Without having tested it, something like this should work. In more complicated
cases, make it a method on the struct.
users.sorted({ ($0.lastName ?? "") < ($1.lastName ?? "") })
/Magnus
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution