Swift is a general-purpose programming language created by Apple as a modern alternative to Objective-C. It is designed to be fast for systems programming, safe in terms of error checking, and easy to use. It was made open source and available under the Apache Licence 2.0 for Apple’s platforms and Linux at the end of last year.
Sum and product of an array
let a = [1, 2, 3, 4, 5]
println(a.reduce(0, +)) // prints 15
println(a.reduce(1, *)) // prints 120
println(reduce(a, 0, +)) // prints 15
println(reduce(a, 1, *)) // prints 120
Reason To learn
You’re an iOS developer and you want to move away from Objective-C. As a more modern general-purpose language, you should eventually be able to do most things in Swift, more quickly and with fewer errors.