seq.sorted(by:)

// sorted(by:)
func sorted(
  by areInIncreasingOrder: (Self.Element, Self.Element) throws -> Bool
) rethrows -> [Self.Element]

็”จ้€™ๅ€‹ๆ–นๆณ•็š„ๅ„ช้ปžๆ˜ฏ๏ผšSelf.Element ไธ้œ€่ฆๆ˜ฏ Comparableใ€‚

// โญ๏ธ 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