$0
is the first parameter passed into the closure. $1
is the second parameter, etc. That closure you showed is shorthand for:
let sortedNumbers = numbers.sort { (firstObject, secondObject) in
return firstObject > secondObject
}
More Related Contents:
- how to check if there is any string from index 0 to 5 in an array of type Any [closed]
- remove an index number from array
- How to check if an element is in an array
- How to sort an array of custom objects by property value in Swift
- Two-dimensional array in Swift
- How do I insert an element at the correct position into a sorted array in Swift?
- Converting a C char array to a String
- Shorthand to test if an object exists in an array for Swift?
- How to get list of common elements of 2 array in Swift?
- Swift sort an array with strings and numbers [duplicate]
- Flatten [Any] Array Swift
- How to remove an element from an array in Swift
- Is it possible to make an Array extension in Swift that is restricted to one class?
- Cannot convert value of type ‘Meme!’ to expected argument type ‘@noescape (Meme) throws -> Bool’
- Swift 3 2d array of Int
- Find Duplicate Elements In Array Using Swift
- How can I interleave two arrays?
- Swift 4 JSON Codable – value returned is sometimes an object, others an array
- swift: modifying arrays inside dictionaries
- Extending Array to check if it is sorted in Swift?
- How can I convert an array to a tuple?
- How to stable sort an array in swift?
- How to return first 5 objects of Array in Swift?
- New Array from Index Range Swift
- Iterate over two arrays simultaneously
- In Swift how can I sort one array based on another array?
- How to forward functions with variadic parameters?
- Concatenate Swift Array of Int to create a new Int
- check if all elements of an array have the same value in Swift
- Swift: Binary search for standard array?