Modern Networking Layers in iOS Using Async/Await | by Daniele Margutti | Mar, 2022

A fresh look at the networking topic that takes advantage of Swift’s Concurrency Model

  • Extensible interface: you can create a custom body container for your own data structure and set them directly. Just make it conforms to the HTTPSerializableBody protocol to allow the automatic serialization to data stream when needed.
  • Easy to use APIs set: you can create all of these containers directly from the static methods offered by the HTTPBody struct
  • nextValidator: just pass the handle to the next validator
  • failChain: stop the chain and return an error for that request
  • retry: retry the origin request with a strategy
  • API Calls are organized in namespaces based upon their context
  • Each Resource describes a type-safe approach to create a remote request
  • Each Resource contains all the logic which generate a valid HTTP Request

Conclusion

Leave a Comment