Swift Tutorial
Swift is an open-source programming language that supports multiple programming paradigms and compilation. It was introduced by Apple at the 2014 WWDC (Apple Worldwide Developers Conference) for developing iOS, OS X, and watchOS applications.
Swift combines the strengths of C and Objective-C without the constraints of C compatibility.
Swift can run on Mac OS and iOS platforms alongside Objective-C in the same runtime environment.
On June 8, 2015, Apple announced at WWDC 2015 that Swift would be open-sourced, including the compiler and standard library.
Who is This Tutorial For?
This tutorial is suitable for individuals looking to develop mobile (iPhone) or OS X applications. Prior programming experience is beneficial.
All examples in this tutorial are based on Xcode 8.2.1 (using Swift 3.0.2 syntax).
First Swift Program
The first Swift program typically begins with outputting "Hello, World!" as shown below:
Example
/* My first Swift program */
var myString = "Hello, World!"
print(myString)
Example Analysis
var myString = "Hello, World!": Defines a variable
myString
using thevar
keyword, with the value "Hello, World!"print: Outputs the value of the variable