Given this array of tuples:
var tupleArray = [(String, Int)]() tupleArray.append(("bonjour", 2)) tupleArray.append(("Allo", 1)) tupleArray.sort { (t1 , t2) -> Bool in let (_, n1) = t1 let (_, n2) = t2 return n1 < n2 }
I would like to make the closure shorter by doing something like this:
tupleArray.sort { ((_, n1) , (_, n2)) -> Bool in n1 < n2 }
First: is this possible? Second: if possible, what is the syntax?
thanks
source share