Daily iOS
Swift

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))?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

For synchronous and async call paths, throws is the default. The compiler forces you to write try, and it combines naturally with async/await.

Share a question