Sorting of arrays elements in Swift
Forums:
var numbers = [ 11, 2, 5, 7, 3 ]
//the first method
numbers.sortInPlace({ $0 < $1 })
//the second method
numbers = numbers.sort({ $0 < $1 })
//descending
numbers.sortInPlace({ $1 < $0 })
- Log in to post comments