In Swift 3 I define my array as:
var filteredObjects = [Int: CustomObject]()
then I populate array with data:
filteredObjects[filteredObjects.count] = CustomObject
Now I want to sort array by (1) property "title" of CustomObject which is a String and (2) a float property "distance" of CustomObject.
When I try:
filteredObjects.sort({ $0.distance < $1.distance })
it produces error Value of tuple type (key:Int, value:CustomObject) has no member distance
I suspect I cannot use sort method like this but I cannot find the solution.
let sortedTuples = filteredObjects.sorted{ $0.value.distance < $1.value.distance }