In Swift 2.0, how would you go about sorting an array of custom objects by a property? I know in Swift 1.2, this was done using sorted() and sort(). However, these methods n
In swift 3.0
I have taken the assumption same as the example asked in the question.
i.e customObject is MyObject with variable myDate. The array of the MyObject is myArray.We can sort like this simply.
myArray.sort(by: { (one: MyObject, two: MyObject) -> Bool in one. myDate < two. myDate })