sort
- self에 바로 적용sorted
- 정렬된걸 returnby: >
var myArray = [3, 4, 1, 5, 66 ,2]
var descendingArray = myArray.sorted(by: >)
myArray.sort(by: >)
struct Todo: Comparable, Hashable{
//기준 정하기(id)
static func <(lhs: Todo, rhs: Todo) -> Bool{
return lhs.id < rhs.id
}
var id : Int
var title: String
}