Swift is a general-purpose, compiled programming language developed by Apple Inc. for iOS, iPadOS, macOS, watchOS, tvOS, Linux, and z/OS.

Why would I learn this language?

Heavily influenced by Python and Ruby, Swift was designed to be beginner-friendly and fun to use.

Swift has uses ranging from systems programming, to mobile and desktop apps, scaling up to cloud services. Swift is also designed to make writing and maintaining correct programs easier.

Starting Points

Online courses to learn Swift
Learn how to program from scratch using Swift and learn many fundamental concepts that will get you started writing code immediately.
Swift tutorial
A mini-series on getting started with programming in Swift. Learn Swift programming basics using playgrounds.

Example Code

The following is an example of the Fizz Buzz problem. You can run and edit this program here.

for i in 1...100
    if i % 3 == 0 && i % 5 == 0 {
    } else if i % 3 == 0 {
    } else if i % 5 == 0 {
    } else {

The following is an example of the 100 doors problem. You can run and edit this program here.

/* declare enum to identify the state of a door */
enum DoorState : String {
    case Opened = "Opened"
    case Closed = "Closed"
/* declare list of doors state and initialize them */
var doorsStateList = [DoorState](repeating: DoorState.Closed, count: 100)
/* do the 100 passes */
for i in 1...100 {
    stride(from: i - 1, to: 100, by: i).map {
        doorsStateList[$0] = doorsStateList[$0] == .Opened ? .Closed : .Opened
/* print the results */
for (index, item) in doorsStateList.enumerated() {
    print("Door \(index+1) is \(item.rawValue)")

Further Reading

comments powered by Disqus