I have an array
of structs
.
struct Item {
let textLabel : NSDate
let detailTextLabel : NSDate
}
I sorted them with the following code:
myArray.sort{$0.textLabel.compare($1.textLabel) == NSComparisonResult.OrderedAscending}
What's the longer version of the sorting above?
There is a way to make a long version of sorting. Namely the following:
{$0.textLabel.compare($1.textLabel)
Something like this:
func sorterForFileIDASC(this:imageFile, that:imageFile) -> Bool {
return this.fileID > that.fileID
}
But how would I apply it to my code snippet?