Swift is the new black

What it is?

Swift is a new programming language for iOS, macOS, watchOS, and tvOS app development.

What it is?

It has a clean and modern syntax, offers seamless access to existing C and Objective-C code and frameworks, and is memory safe by default.

 

Memory safety is the state of being protected from various software bugs and security vulnerabilities when dealing with memory access, such as buffer overflows and dangling pointers.

Wikipedia

Swift is?

  •  Multi-paradigm
    • Protocol-oriented
    • Object-oriented
    • Functional
    • Imperative
  • Typing
    • Static
    • Strong
    • Inferred 

Compiled

  • LLVM
  • C Run-time

Features

struct x class

Features

Access control

Features

Property observers

Features

Automatic Reference Counting

Features

Enums

Features

Protocol

Features

Function Argument Labels and Parameter Names

 

Features

strong x weak

“Use a weak reference whenever it is valid for that reference to become nil at some point during its lifetime. Conversely, use an unowned reference when you know that the reference will never be nil once it has been set during initialization.” 

Apple Documentation

Features

Error handling

Features

Optional

Features

If let x guard let

Features

Extension

Features

Closure aka () => {}

Swift

By Italo Lino

Swift

  • 42