Request state machine
A screen with a network request has loading, success, failure, retry, refresh, and cancel states all tangled together. How do you design those state transitions?
A screen with a network request has loading, success, failure, retry, refresh, and cancel states all tangled together. How do you design those state transitions?
Define the state as an enum with associated values (idle/loading/loaded(data, isRefreshing)/failed(error, lastData)), and decide transitions in one place only, a (state, event) → state function.
ArchitectureShort answerAdvanced
Your team is evaluating TCA (The Composable Architecture). What problems does TCA solve?
#unidirectional
ConcurrencyShort answerBasics
You're building an image pipeline: download, resize, then save to the disk cache, and…
#cancellation
ConcurrencyShort answerBasics
In Swift Concurrency, when you create a Task { }, when and where does that code run?
#cancellation
ConcurrencyMultiple choiceAdvanced
Which of the following statements about structured concurrency (async let, TaskGroup) are…
#cancellation