How to sort two dimensional array in Swift?

Let's have an array
var arr:[(type:Int,name:String)] = []

Swift how to sort it (for example, ascending) for one of the fields? For example field type:Int?
July 8th 19 at 11:32
1 answer
July 8th 19 at 11:34
Well, let's start with the fact that it is a one-dimensional array.
arr.sort { (first, second) -> Bool in
 return first.type < second.type

If we recall the features of Clojure, it, you can write it as follows:
arr.sort { $0.type < $1.type }
Thank you very much - janet_Ziemann97 commented on July 8th 19 at 11:37

Find more questions by tags ArraysSwift