Sorry for the complex wording of the question. My main experience is with PHP and it has a command called array_multisort. The syntax is below:
bool array_mu
Edit this is valid for 2 arrays:
Adding to @AlainT answer, but using zip:
zip
var names = [ "Paul", "John", "David" ] var ages = [ 35, 42, 27 ] let sortedTuple = zip(names, ages).sort { $0.0.0 < $0.1.0 }
Something more generic:
names.enumerate().sort({$0.1<$1.1}).map({ (name: $0.1, age: ages[$0.0]) })