iOS for Android developers · check

Know The Android blocks, on iOS already?

One question for each of the 5 puzzles in this module. A right answer marks that puzzle as passed, so you can jump ahead. A wrong one tells you which puzzle to start with. Nothing is sent anywhere: it's saved in this browser.

Puzzle 0: Frozen, not stopped

Your iOS app starts a 30-second upload in an ordinary session, and the user leaves the app after 5 seconds. You did nothing special. What happens?

Not quite. On iOS, a suspended app runs no code at all; the upload stops with it. Learn it in puzzle 0 →

Right. Suspended means no code runs, on any thread.

Not quite. Suspension stops every thread of the app, not only the main one. Learn it in puzzle 0 →

Puzzle 1: The run loop is your Looper

On iOS, you read a large file on the main thread, and it takes 2 seconds. The user taps meanwhile. What happens?

Not quite. Touches are the main run loop's job; they wait behind your file read. Learn it in puzzle 1 →

Right. One loop, one thing at a time.

Not quite. A run loop runs each piece of work to the end; it can't pause your read halfway. Learn it in puzzle 1 →

Puzzle 2: Queues, not handlers

You add three tasks to a serial queue, one after another. How do they run?

Right. Serial: one at a time, in order.

Not quite. A serial queue keeps the order: first in, first out. Learn it in puzzle 2 →

Not quite. That's a concurrent queue; a serial one runs one task at a time. Learn it in puzzle 2 →

Puzzle 3: The main actor

Inside a @MainActor function, you await a network call that takes 2 seconds. Does the screen freeze?

Right. await gives the thread back while waiting.

Not quite. No manual queue is needed: await already lets the main thread go. Learn it in puzzle 3 →

Not quite. At an await, the function gives up its thread; the main thread keeps handling touches. Learn it in puzzle 3 →

Puzzle 4: Counting, not collecting

A screen holds its view model strongly, and the view model holds the screen strongly. The user closes the screen. What happens on iOS?

Right. A cycle keeps both counts above zero.

Not quite. Closing the screen doesn't change the counts; both stay at one. Learn it in puzzle 4 →

Not quite. There's no collector to notice: ARC only counts, and each count stays at one. Learn it in puzzle 4 →

Back to the overview →