Stage 1 · Lesson 1 of 10
Constants, variables and types
uses let for constants and var for variables. Xcode warns you when a var never changes, so default to let. Swift uses , so let count = 3 is an Int without you saying so.
Swift never converts numbers silently: adding an Int and a Double needs an explicit Double(count). Learn the basic types (Int, Double, Bool, String, Character) and , as in "Hello \(name)". let behaves differently for and classes.
For a struct, let makes the whole value unchangeable. For a class, it only fixes the reference, so the object itself can still change. That difference is the start of the topic below.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with
- CourseFree100 Days of SwiftUI
Paul Hudson (Hacking with Swift) · Beginner
Days 1 to 15 teach Swift, with a checkpoint exercise every other day