Courses / Mobile development / Swift Programming

Free courseSelf-paced

Swift Programming

Build a tested Swift application with value-type models, error handling, async code and JSON persistence using SwiftPM.

  • Who it's for. Beginners who have finished Programming Problem Solving and want to learn Swift on a portable toolchain.
  • Before you start. Completion of Programming Problem Solving or equivalent: you can read a short problem, list inputs and outputs, trace variables by hand, and use a loop and a condition in any language.
  • 29 to 49 hours of study with practice
  • 8 modules, 52 lessons
  • 3 guided projects and a final project

What you'll learn

  • Install the swift.org toolchain on macOS, Linux or Windows, create SwiftPM packages and run `swift build`, `swift run` and `swift test`.
  • Write control flow, functions and closures, including exhaustive switch, guard, argument labels and inout.
  • Choose between struct, class and enum, and explain reference counting, weak references and initialisation rules.
  • Abstract behaviour with protocols, protocol extensions and generics, including Codable for persistence.
  • Structure an app as a library plus thin executable, test it with `swift test`, persist state to JSON, and demonstrate it.

Skills you'll gain

  • Swift workspace
  • Types
  • optionals
  • Control flow
  • functions
  • Collections
  • Structures
  • classes
  • Protocols
  • generics
  • Errors
  • concurrency
  • Application tests

Tools you'll use

  • Swift
  • Swift Package Manager
  • swift test
  • Codable

Details to know

  • Certificate on completionIssued after your final project is reviewed
  • 8 module checkpointsA quiz and a practical task close each module
  • Self-pacedStudy any time; your progress is saved

How every lesson works

Each lesson follows the same four steps, so you always know what comes next.

  1. 01

    Watch & Learn

    A short animated video explains one idea at a time.

  2. 02

    Guided Practice

    Work through an example step by step and check the result.

  3. 03

    Quiz & Challenge

    Short questions check the idea has landed before you move on.

  4. 04

    Mini Project

    Build something useful from a project brief.

Learn at your own pace

This is a self-paced course. There are no live classes and no fixed timetable.

  • Start any timeStudy when it suits you. Lessons are short, so they fit around work or college.
  • Pick up where you left offYour progress is saved to your account.
  • Ask when you're stuckUse Ask Mentor inside the learning platform.

Your path in 4 phases

Each phase ends with something you have built and checked.

  1. 01

    Modules 1 to 4

    Pantry ledger command-line tool

    Covers Swift workspace, Types and optionals, Control flow and functions and Collections.

    You build: Pantry ledger command-line tool: A SwiftPM executable `pantry` that prints usage with no arguments and echoes parsed arguments with interpolation.

  2. 02

    Modules 5 to 6

    Typed domain models for the pantry

    Model data with structs, enums and classes, explain value versus reference semantics, initialisation rules and reference counting, and choose the right kind of type for a model.

    You build: Typed domain models for the pantry: Value-type `Item` and `Shelf` structs with computed totals and a mutating restock method.

  3. 03

    Module 7

    Failure-aware stock service with async reload

    Model, throw and handle recoverable errors, clean up with defer, and write async code with structured concurrency and actors while knowing which failures are thrown, returned or trapped.

    You build: Failure-aware stock service with async reload: A `StockError` enum and throwing parser with do-catch at the command boundary.

  4. 04

    Module 8

    Swift application with value models error handling and tests

    Structure a Swift application as a testable library with a thin executable, test it with `swift test` including error and async paths, persist state as JSON, and package it with setup instructions that work on macOS, Linux and Windows.

    You build: The final project, demonstrated to a trainer.

Full curriculum

8 modules and 52 lessons, 29 to 49 hours of study

01Swift workspace6 lessons, 3 to 4 hours

Lessons

  • Installing the portable toolchain and checking it
  • Creating and running a SwiftPM executable package
  • Entry points: main.swift top-level code versus @main
  • Printing, string interpolation and command-line arguments
  • Constants, variables and naming with let and var
  • Reading build output: errors, warnings, fix-its and release builds

After this module you can

  • Install Swift from swift.org on your own OS and record the output of `swift --version` to prove which compiler you will use all course.
  • Create a package with `swift package init --type executable`, build it, run it by name and point to the three files and folders it generated.
  • Read a compiler diagnostic by file, line and column, apply its suggested fix, and tell debug builds from release builds.
02Types and optionals6 lessons, 3 to 4 hours

Lessons

  • Integers, floating-point numbers and explicit conversion
  • Strings, Characters and why indexing is not an integer
  • Type inference, annotations and tuples
  • Optional as a type: absence, nil and Int(String)
  • Safe unwrapping: if let, guard let, nil-coalescing and optional chaining
  • Force unwrapping, implicitly unwrapped optionals and why they trap

After this module you can

  • Predict the result or compiler error when Int and Double values are mixed, converted or pushed past Int.max.
  • Explain why `String.count` counts characters differently from UTF-8 bytes and use String.Index and unicodeScalars to inspect text.
  • Identify when `!` is a justified assertion and when it is a bug, and describe the run-time trap when it fails.
03Control flow and functions7 lessons, 3 to 5 hours

Lessons

  • Conditions: if, else if, the ternary operator and Bool-only tests
  • Exhaustive switch: patterns, ranges, tuples and where clauses
  • Loops and ranges: for-in, while, repeat-while, stride and labels
  • guard and early exit
  • Functions: argument labels, parameter names and return values
  • Default values, variadic parameters and inout
  • Closures and functions as values

After this module you can

  • Write branching code where every condition is a real Bool and predict short-circuit behaviour of && and ||.
  • Write a switch that the compiler accepts as exhaustive and explain why Swift needs no `break` between cases.
  • Write closure expressions in full and shorthand forms, store functions in constants and explain value capture.
04Collections6 lessons, 3 to 4 hours

Lessons

  • Arrays: indexing, mutation and value-copy behaviour
  • Dictionary and Set: lookups, defaults and uniqueness
  • map, filter and reduce with closures
  • Sorting and comparison closures
  • Slices, ranges and ArraySlice indices
  • Grouping and counting: Dictionary(grouping:by:) and reduce(into:)

After this module you can

  • Create, read and modify an Array, predict the out-of-range trap and show that assigning an array makes an independent copy.
  • Use Dictionary subscripts, default values and Set operations, and explain why dictionary lookup returns an Optional and iteration order is not a contract.
  • Group items by a key and tally them using Dictionary(grouping:by:) and reduce(into:), and print the results in a deterministic order.
05Structures and classes7 lessons, 3 to 5 hours

Lessons

  • Structs: stored properties, methods and mutating
  • Initialisers: memberwise, custom and failable
  • Computed properties and property observers
  • Enumerations with raw values and associated values
  • Classes and reference semantics
  • Inheritance, override and final
  • Automatic reference counting, weak and unowned references

After this module you can

  • Declare a struct with stored properties and methods, and explain why a method that changes properties must be marked mutating and called on a var.
  • Write custom initialisers, keep the memberwise one by using an extension, and return nil from a failable initialiser for invalid input.
  • Explain how ARC releases class instances, create a retain cycle, and break it with weak or unowned.
06Protocols and generics7 lessons, 3 to 5 hours

Lessons

  • Protocols: requirements and conformance
  • Protocol extensions and default implementations
  • Equatable, Hashable, Comparable and CustomStringConvertible
  • Codable and JSON with Foundation
  • Generic functions and type constraints
  • Generic types, extensions and constrained extensions
  • Associated types, some and any

After this module you can

  • Declare a protocol with property and method requirements, conform two unrelated types to it and use the protocol as a type.
  • Give a protocol default behaviour with an extension and predict which implementation runs for requirement versus non-requirement methods.
  • Explain what an associatedtype adds to a protocol and choose between `some` (opaque) and `any` (existential) types.
07Errors and concurrency7 lessons, 3 to 5 hours

Lessons

  • Defining and throwing errors
  • Handling errors: do-catch, try?, try! and propagation
  • defer and cleanup order
  • Result, preconditions and choosing between throwing and trapping
  • async and await
  • Structured concurrency: async let and task groups
  • Actors, Sendable and data-race safety

After this module you can

  • Define an error enum conforming to Error, mark a function throws and throw specific cases with useful associated values.
  • Call throwing functions with do-catch pattern matching, try? and propagation, and explain why try! is risky.
  • Protect shared mutable state with an actor, explain why access is awaited, and read a Swift 6 data-race diagnostic.
08Application tests6 lessons, 3 to 4 hours

Lessons

  • Splitting a library target from a thin executable
  • Writing and running tests with swift test
  • Testing boundaries, errors and parameterised cases
  • Test doubles and dependency injection with protocols
  • Persisting state as JSON and proving a restart
  • Packaging the application: exit codes, README and a clean-clone check

After this module you can

  • Restructure a package into a library target holding the logic and an executable target that only parses arguments and prints, so tests can import the logic.
  • Write a first test that calls a library function, run it with `swift test` and read a failing result.
  • Prepare the app for demonstration with consistent exit codes, release build instructions and a README that works on a clean checkout on each OS.

What you'll build

3 guided projects along the way, then a final project.

  • Pantry ledger command-line tool

    after module 4
  • Typed domain models for the pantry

    after module 6
  • Failure-aware stock service with async reload

    after module 7

Final project

Swift application with value models error handling and tests. Options: Habit tracker engine; Workshop booking ledger; Expense splitter.

What you submit

Source submission: a SwiftPM package with a library target, a thin executable target and a test target no force unwrap, try! or as! except where justified in a comment.

How it's reviewed

Trainer review against a weighted rubric: Correctness against trainer-chosen inputs (30%) Modelling: value types, enums and protocols used where fitting (20%) Failure handling and absence of force unwraps (15%).

Where you'll use it

  • Model records as structs and enums and handle missing values without force unwrapping.
  • Save and reload app state as JSON and test the error paths.

Roles that use these skills

  • Swift developer
  • iOS developer (foundation)
  • Software developer

Earn the certificate by building, not watching

  1. Complete the lessons and pass each module checkpoint.
  2. Build your final project and demonstrate it.
  3. OUTLEARN reviews your project and issues your certificate. It is not issued automatically.

Frequently asked questions

What should I know before starting?

The course expects Programming Problem Solving or an accepted equivalent. Completion of Programming Problem Solving or equivalent: you can read a short problem, list inputs and outputs, trace variables by hand, and use a loop and a condition in any language. A short diagnostic check is described in the entry requirements.

What do I build for the final project?

You choose one of 3 options: Habit tracker engine; Workshop booking ledger; Expense splitter. It is reviewed by a trainer in a live demonstration.

When do I get a certificate?

Only after you build and demonstrate your live project. OUTLEARN staff issue certificates; nothing is issued automatically.

Be first in when Swift Programming opens

Email us and we will tell you as soon as enrolment opens.

Notify me when it opens
FreeOpens soon
Notify me