有
func allItems() -> [TodoItem] {
var todoDictionary = NSUserDefaults.standardUserDefaults().dictionaryForKey(ITEMS_KEY) ?? [:]
let items = Array(todoDictionary.values)
*return items.map({TodoItem(deadline: $0["deadline"] as NSDate, title: $0["title"] as String, UUID: $0["UUID"] as String!)}).sorted({
return ($0.deadline.compare($1.deadline) == .OrderedAscending)
})
}
我在使用星号的行上收到此错误:
cannot invoke ‘sorted’ with an argument list of type ‘((_. _)->_)'
有没有人遇到过这个问题,或者你知道为什么会出现错误吗?