Making a community layer utilizing async/await for iOS variations under 15 and with good scalability

The fabric might be helpful, each for rookies and a classy customer, I believe you could find one thing attention-grabbing
It began with the truth that Apple introduced async / await, I wished to attempt it in motion. And since at the moment there have been no ready-made options for the proposal of this know-how, it was determined to give you one thing simply extensible, handy for debugging and arbitrary for making adjustments
Let’s begin with the URLRequest
extension, as a result of commonplace parts shouldn’t have a handy device for working with community request strategies
The next are the protocols:
NetConfigType
— to configure the community layer,NetRoutes
— servicing the request manufacturing unit with carried out strategies, to assemble the request
For added comfort, we add a mannequin that can enable us to conveniently current the response of a community request for its subsequent processing:
Let’s describe the entry level for our future requests and the center of our future community layer:
We implement a request manufacturing unit by closing the implementation with a protocol:
Hooray! Our community layer is prepared
This manufacturing unit might be simply scaled utilizing nesting enum
:
Utilizing the described community layer may be very easy and comes all the way down to calling a single methodology. One thing like this:
This resolution turned out to be fairly light-weight and simple to increase, it is sufficient to exchange the implementation of the community request and you may get a reactive strategy by means of Writer, or you need to use the usual strategy by means of closures.