Skip to content
Prepare to Grow
Beginner module

Swift Fundamentals

Learn the language concepts that make iOS code predictable: values, control flow, functions, collections, custom types, generics, ownership, concurrency, testing, and data decoding.

20 lessonsAbout 1 hr 26 min
Start Swift fundamentals

Meet the language

Swift is multi-paradigm by design.

Swift supports several ways to organize software because different problems need different ownership and behavior. Value-oriented design keeps state independent and predictable, protocol-oriented design describes reusable capabilities, object-oriented design models identity and framework relationships, and functional techniques pass behavior as values.

01

Value-oriented

Use structures and enums when independent values and explicit state changes make the model easier to reason about.

02

Protocol-oriented

Use protocols when different types should share a capability without sharing one class hierarchy.

03

Object-oriented

Use classes when identity, shared lifetime, inheritance, or an Apple framework contract matters.

04

Functional techniques

Use functions and closures to transform values and pass focused behavior through APIs.

Module outcomes

Build a language foundation you can reason about.

Complete these lessons in order. Each concept becomes part of the vocabulary used later in SwiftUI and application architecture.

  • Read and write essential Swift syntax.
  • Model values, absence, and valid states clearly.
  • Organize behavior with functions and closures.
  • Use protocols and errors at meaningful boundaries.
  • Manage ownership, concurrency, and verification responsibly.

Learning sequence

Twenty essential lessons

  1. 01Variables, Constants, and Data TypesLearn how Swift stores values, infers types, and uses constants to make intent clear.4 min
  2. 02Operators and String InterpolationCombine, compare, and transform values while producing readable text output.4 min
  3. 03Conditions and switchDirect program behavior with if, else, guard, and exhaustive switch statements.4 min
  4. 04LoopsRepeat work safely with for-in, ranges, while, and clear exit conditions.4 min
  5. 05Functions and ParametersPackage behavior into named, reusable units with clear inputs and outputs.4 min
  6. 06Arrays, Sets, and DictionariesStore groups of values using collection types chosen for order, uniqueness, and lookup.4 min
  7. 07Understanding OptionalsModel missing values explicitly and unwrap them safely with binding, guard, chaining, and defaults.4 min
  8. 08Structures, Enumerations, and Value SemanticsModel independent values and finite states with Swift structures and enumerations.4 min
  9. 09Properties, Methods, and InitializersBuild well-formed Swift types with stored state, derived values, behavior, and safe initialization.4 min
  10. 10Object-Oriented Programming in SwiftUnderstand class identity, encapsulation, inheritance, overriding, and when object-oriented design fits Swift.4 min
  11. 11Polymorphism and Type CastingWork safely with superclass references, overridden behavior, runtime type checks, and conditional casts.5 min
  12. 12ClosuresPass behavior as values, transform collections, and understand captured context.4 min
  13. 13Protocols and ExtensionsDefine shared capabilities and add focused behavior without changing original declarations.4 min
  14. 14Error HandlingRepresent recoverable failures with Error, throw, throws, do-catch, and defer.5 min
  15. 15GenericsWrite reusable, type-safe functions and types with generic parameters, constraints, and associated types.5 min
  16. 16Access Control and ModulesProtect implementation details and design clear boundaries with private, internal, package, and public access.4 min
  17. 17ARC and Memory ManagementUnderstand object lifetime, strong reference cycles, and the careful use of weak and unowned references.4 min
  18. 18Async/Await and Swift ConcurrencyWrite structured asynchronous code with async/await, tasks, actors, cancellation, and Sendable values.5 min
  19. 19Testing and Debugging Swift CodeVerify behavior with focused tests and investigate failures systematically with Xcode debugging tools.4 min
  20. 20Codable and JSONConvert Swift models to and from JSON safely with Codable, coding keys, nested containers, and decoding strategies.6 min