🍎

Swift Reference

The powerful and intuitive programming language for iOS, macOS, watchOS, and tvOS. Essential syntax and code samples for professional development.

Var vs Let

let pi = 3.14 var score = 0

Optionals

var name: String? if let val = name { print(val) }

Closures

let doubled = list.map { $0 * 2 }

Structs

struct User { var id: Int var name: String }

Switch

switch x { case 1: print("One") default: break }

Protocols

protocol Drawable { func draw() }