A Swift introduction

A Swift introduction

Since its initial release in 2014 and subsequent open-sourcing in 2015 Swift has become one of the most popular programming languages in the world — used everywhere from mobile to Macs to microservices. We will examine the various similarities and differences between Swift and other languages, and take a peek at the unique community that has formed around it.

20cd0627a5c82f8b3e4f30a04745f0cf?s=128

Neil Kimmett

February 21, 2017
Tweet

Transcript

  1. 3.
  2. 7.
  3. 8.
  4. 9.
  5. 10.
  6. 12.

    let names = ["Jeff", "Samantha", "T-Pain"] names.map { string in

    return string.appending(" is super cool!") }
  7. 16.

    class Person { var name: String let dateOfBirth: Date init(dateOfBirth:

    Date, name: String) { self.dateOfBirth = dateOfBirth self.name = name } }
  8. 17.

    class Person { var name: String let dateOfBirth: Date init(dateOfBirth:

    Date, name: String) { self.dateOfBirth = dateOfBirth self.name = name } func dayOfBirth() -> DayOfWeek { return … } }
  9. 26.

    let userInput = "1989-08-27" let formatter = DateFormatter(format: "YYYY-MM-DD") let

    maybeDate = formatter.date(from: userInput) if let date = maybeDate { … }
  10. 29.

    enum DayOfWeek { case Mon, Tue, Wed, Thu, Fri, Sat,

    Sun func isWeekend() -> Bool { switch self { case .Mon, .Tue, .Wed, .Thu, .Fri return false case .Sat, .Sun return true } }
  11. 30.

    let maybeDate = formatter.date(from: string) if let date = maybeDate

    { let person = Person(dateOfBirth: date, name: name) if person.dayOfBirth().isWeekend() { … } }