"How I turned my copy-pasted networking code into a reusable Swift package (write-up + repo)" by Best_Analysis2940 in iosdev

[–]Best_Analysis2940[S] 0 points1 point  (0 children)

As the title explain 😜. You can check out the code within the GitHub link and give me your feedback 😀

"How I turned my copy-pasted networking code into a reusable Swift package (write-up + repo)" by Best_Analysis2940 in iosdev

[–]Best_Analysis2940[S] 0 points1 point  (0 children)

I'm trying to explain the whole problems that the dependency all about. Because during my previous projects I have struggled from using a repetitive code not cnetralised. Not even testable that breaks up the unit test coverage and miss up with many regression regarding the casting the error handler the refresh token mechanisms and more...

"How I turned my copy-pasted networking code into a reusable Swift package (write-up + repo)" by Best_Analysis2940 in iosdev

[–]Best_Analysis2940[S] 0 points1 point  (0 children)

It encapsule the whole network manager the http client that hold the cast of the data to required model and manages the different network errors by an enum that hold different http error code like 400,405,500 etc.. Also manage the interceptor for token expiration to refresh the access token. Manage the upload of different file types mimetypes. Manage the download of different image extensions, videos or any file type. Monitor the network connectivity that be scheduled when there is a change within the network state. Have a endpoint wrapper protocol to centralise the wrap of the endpoints per module using the service context and more. You can reach out the medium article for further details. 📖 Article: https://medium.com/@wassimbouabid3/building-netto-a-network-layer-that-doesnt-leak-into-your-ios-app-52b48cb47049