Mobile development

Stage 1 · Lesson 9 of 10

async/await basics

Swift fundamentals

lets you write async code in order, top to bottom. A function marked async can pause while it waits, for example for a network response, and you call it with await. From ordinary code, such as a button action, start the work with Task { }.

Use async let to run independent calls together and wait for both results. UI updates must happen on the , the part of the app that owns the screen. views and @MainActor types handle this for you.

Swift 6 checks for data races at compile time. A data race is two threads touching the same value at once, so expect warnings about sending values between threads.

Common trapstarting a Task and forgetting it may finish after the user has left the screen.

A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock

Resources for this stage

Start with

  • CourseFree
    100 Days of SwiftUI

    Paul Hudson (Hacking with Swift) · Beginner

    Days 1 to 15 teach Swift, with a checkpoint exercise every other day

Practise

  • Dart, TypeScript, Kotlin and Swift tracks with small exercises and free mentor feedback

Keep handy

Also worth your time

Mark this stage as not done?