Error handling
You're designing a network layer with async/await. For error handling in the request functions, which would you make the default: throws, returning Result<T, E>, or Swift 6 typed throws (throws(NetworkError))?
You're designing a network layer with async/await. For error handling in the request functions, which would you make the default: throws, returning Result<T, E>, or Swift 6 typed throws (throws(NetworkError))?
For synchronous and async call paths, throws is the default. The compiler forces you to write try, and it combines naturally with async/await.
NetworkingShort answerBasics
You've found network-layer code that collapses every failure into completion(nil). As a…
#result #typed-throws
ConcurrencyMultiple choiceIntro
Which of the following statements about sync/async and serial/concurrent queues are…
#async
ConcurrencyShort answerAdvanced
Using Swift Concurrency (async/await, actors), design the API of a network client that…
#async
Memory and ARCShort answerAdvanced
This code, which loads an image asynchronously in a UITableView cell, crashes now and…
#async