Michael Long
Mar 6, 2023

--

Not bad. I really don't like returning Result with async/await however.

A call that throws already splits the returned result into success / failure modes, and it makes attempting to chain multiple api requests together a lot more difficult and messier than it needs to be.

Having each request build the adaptor chain also feels clunky, and overall there's no provision for working with another session which might have its on requirements (ephemeral, for example). Nor any provision for response handlers that might, for example, automatically handle session tokens or retrys.

The @MainActor implementation also looks clunky. Should simply mark call makeRequest as @MainActor and not be forced to always write a couple of additional functions to handle UI updates.

--

--

Michael Long
Michael Long

Written by Michael Long

I write about Apple, Swift, and SwiftUI in particular, and technology in general. I'm also a Lead iOS Engineer at InRhythm, a modern digital consulting firm.

Responses (1)