In C / Objective-C it is possible to find the minimum and maximum value between two numbers using MIN and MAX macros. Swift doesn\'t support macros and it seems that there a
As pointed out, Swift provides max and min functions.
An example (updated for Swift 2.x).
let numbers = [ 1, 42, 5, 21 ]
var maxNumber = Int()
for number in numbers {
maxNumber = max(maxNumber, number as Int)
}
print("the max number is \(maxNumber)") // will be 42