I'm trying to sort my contacts array by severity
var contacts: [Contact]?
if let customer = CoreDataAccess.sharedInstance.getSavedCustomer() {
//Cast from NSSet to [Contact]
self.contacts = customer.contacts.allObjects as? [Contact]
self.contacts!.sort({$0.severity < $1.severity}) //error
}
The compiler errors out at the marked line with the following message:
Cannot invoke 'sort' with an argument list of type '((_, _) -> _)'
I'm not sure what I'm doing wrong because this exact same thing worked in another file. If it helps to explain, the above code crashes when running on the WatchKit interface, but not when used in iOS.
EDIT: severity is an NSNumber
severitydeclared? What type does it have?