What would be the cleanest way to sort one array to match another array:
Example:
public class Account {
public var identifier: String
init(id identifier:String) {
self.identifier = identifier
}
}
let knownOrder = ["abc", "klm", "def", "hij"]
var givenOrder = [Account(id: "abc"), Account(id: "def"), Account(id: "hij"), Account(id: "klm")]
what would be the easiest way to make the output for givenOrder match knownOrder without altering knownOrder?
Added a little more to the example. Im trying to get the given list of Account objects with an identifier property to be in the same order as a stored list of strings which match the users preference to have their accounts
givenOrder = knownOrder?