seq.sorted(by:)
// sorted(by:)
func sorted(
by areInIncreasingOrder: (Self.Element, Self.Element) throws -> Bool
) rethrows -> [Self.Element]
// โญ๏ธ 1. sort a Sequence using `sorted(by:)` method.
// - always returns an Array.
let sorted = todolist.sorted { a, b in a.date < b.date }
Last updated
Was this helpful?