Swift flashcards
Apple's safe, fast language for iPhone, iPad, Mac and Watch apps.
What is Swift, in one plain sentence?
Swift is a programming language made by Apple for building apps that are fast, safe and easy to read.
Tap to turn over. Swipe right if you know it, left to see it again.
What you will learn
Start from zero
- What Swift is and why it exists4 cards
- Key words4 cards
- Getting ready3 cards
Core basics
- Values and types2 cards
- Optionals2 cards
- Control flow2 cards
- Functions2 cards
- Collections3 cards
- Structs and classes3 cards
- Enums and errors2 cards
Next steps
- Protocols, generics and Codable5 cards
- Closures and memory3 cards
- Concurrency4 cards
- SwiftUI2 cards
- Packages and testing2 cards
Go deeper
- Value types and performance3 cards
- Swift 6 concurrency4 cards
- Advanced language4 cards
- Debugging and production3 cards
- Swift beyond the iPhone3 cards
Final test and certificate
10 questions drawn fresh from the whole topic, about 15 minutes. Sign in, score 80% or more and get a free certificate with your name and a public check link anyone can open, such as an employer or a teacher. Not signed in? Try a practice test from the cards.
Take the final testAbout these cards
- Reviewed 26 October 2026
- CoversSwift 6.3Xcode 26
Checked against
Swift at a glance
Swift is Apple's modern programming language for building apps on iPhone, iPad, Mac, Apple Watch and Vision Pro, and it also runs on servers.
Like a well-designed toolbox with safety guards on every blade: you can build quickly, and the tools stop many slips before they cut you.
Words you will meet
- Constant
- A named box filled once with
letthat never changes - Variable
- A named box made with
varwhose value can change - Type
- The kind of value a box holds, like a whole number (
Int) or text (String) - Function
- A named set of steps, written with
func - Optional
- A box that may hold a value or be empty (
nil), marked with? - Struct
- A bundle of related values that is copied when you pass it around
- Closure
- A small function you can pass around, written in curly braces
- Xcode
- Apple's free app for writing, running and testing Swift apps on a Mac
The steps
- 1. Start from zero (11 cards): What Swift is, where it runs and the words you need.
- 2. Core basics (16 cards): Types, optionals, control flow, functions, collections, structs, classes, enums and errors.
- 3. Next steps (16 cards): Protocols, generics, Codable, closures and ARC, async and actors, SwiftUI, packages and tests.
- 4. Go deeper (17 cards): Copy-on-write, Swift 6 concurrency, typed throws, macros, debugging and Swift beyond the iPhone.
All 11 cards in Start from zero
- What is Swift, in one plain sentence?
- Swift is a programming language made by Apple for building apps that are fast, safe and easy to read.
- Why did Apple create Swift?
- Apple's older language, Objective-C, was hard to learn and easy to crash. In 2014 Apple released Swift with clearer syntax and checks that stop many crashes before an app ships.
- Where do you meet Swift in daily life?
- Banking, food delivery, music and health apps on iPhone; widgets on your home screen; apps on your Apple Watch; and some server software.
- What is an optional, using an everyday picture?
- A gift box that might be empty. Swift makes you open it carefully and check before using what is inside, so the app does not crash on nothing.
- What is the difference between
letandvar? letmakes a constant that never changes, like your birthday.varmakes a variable that can change, like your step count today. Swift preferslet.- What is a struct, in plain words?
- A bundle of related facts, like a contact card with name and phone. When you hand someone a struct, they get their own copy.
- What is a closure?
- A small piece of code in curly braces you pass to something else, like telling a button what to do when tapped:
{ print("Tapped") }. - What are Xcode and SwiftUI?
- Xcode is Apple's free app on the Mac for writing and running Swift apps. SwiftUI is Apple's way to describe screens in Swift code, like 'a list of orders with a button'.
- What do you need to start learning Swift?
- A Mac with Xcode (free from the App Store) to build iPhone apps. For learning the language alone, Swift Playground on iPad or Mac, or Swift on Linux and Windows, also work.
- What does a first Swift program look like?
- No
mainfunction is needed in a simple script; code at the top level runs in order.letstores the name,printshows text and\(name)puts a value inside it. - After this topic, what will you be able to do?
- Write clean Swift, build simple SwiftUI apps, handle data and errors safely, and answer common iOS interview questions.
Swift cheatsheet
Basics
let x = 5 / var y = 0Constant / variable"Hi \(name)"String interpolationfunc f(_ a: Int, to b: Int) -> IntFunction with labelsfor i in 0..<nLoop up to n, excluding nswitch x { case 1...5: ...; default: ... }Exhaustive switchguard cond else { return }Exit early
Optionals
String?May be nilif let x { }Use if presentguard let x else { return }Require or exita?.bOptional chaininga ?? fallbackDefault valuea!Force unwrap (avoid)
Types
struct / classValue copy / shared referenceenum E { case a(Int) }Cases with dataprotocol P { func f() }Contract of abilitiesextension Int { }Add to an existing typesome P / any PFixed hidden type / mixed boxstruct Order: CodableJSON encode and decode
Concurrency
func f() async throwsAsync function that can failtry await f()Call and waitasync let a = f()Run in parallelactor Store { }Race-free state@MainActorRun on the main threadTask { await load() }Start async work from sync code
SwiftUI
@State private var xLocal view state@Binding var xParent's state, read and write@Observable class ModelShared observable model@Environment(\.dismiss)Read environment values.task { await load() }Async work tied to the view#Preview { MyView() }Live preview in Xcode