I have a bit of a strange problem. So I have an array of dictionaries say,
(
Dict 1:
"Name" = "B"
"Number" = "2"
Dict 2:
"Name" = "A"
"Number" = "1"
Dict 3:
"Name" = "D"
"Number" = "4"
Dict 4:
"Name" = "C"
"Number" = "3"
Dict 5
"Name" = "E"
"Number" = "5"
)
And say I have an array:
(
"1"
"4"
"2"
)
How can I get an array that contains all the dictionaries that their "Number" key match each object in that array and have it sorted according to the second array?
e.g. output would be
(
Dict 1:
"Name" = "A"
"Number" = "1"
Dict 2:
"Name" = "D"
"Number" = "4"
Dict 3:
"Name" = "B"
"Number" = "2"
)
I think I can use sortedArrayUsingDescriptors
but I'm not sure how to specify multiple descriptors. Can the descriptors contain every object in the array?
Any help or guidance is much appreciated.