Thanks for taking the time to look at the question.
I am trying to sort a Dictionary of Arrays in descending order, please see the data model below. I cannot use any of the sort methods on this array because the dictionary is nested inside another array.
var data = [[22 : [24 : 2, 35 : 3]], [21 : [24 : 21, 72 : 26 ]], [23 : [43 : 24, 53 : 12]]]
The sort methods don't recognize the dictionary as they are nested. Any thoughts?
var sortedKeysAndValues = Array(data.keys).sorted(<)
This throws an error: Value of type '[[Int : [Int: Int]]]' has no member 'keys'
data.sorted(by: { $0.0 < $1.0 })
This throws an error: Unable to infer closure type in the current context
Data modal
[22 : [24 : 2, 35 : 3]]
The Key is 22. Which holds the value of another Dictionary Arrays [Int: Int, Int: Int]
Ideally want the results to be sorted by the key i.e 24, 23, and 22.
Much appreciate the help.