[Solved] Is there a way to sort an array by a subarray’s index in Swift?


Does this return what you want?

[[1,2] , [3,7] , [2,9] , [10,19]].sorted(by: {$0[0]<$1[0]})

3

solved Is there a way to sort an array by a subarray’s index in Swift?