[Solved] How do I sort an array of an array in Swift 5 [closed]


You can do in following way:

a.sort {
        return $0.last as! Int > $1.last as! Int
    }

Don’t forget to add additional checks while using this code, case where the last item is not an integer or there is an array not in the expected format. Otherwise, it will lead to a crash.

0

solved How do I sort an array of an array in Swift 5 [closed]