Ios networking layer

Hello, I am coming from android world and I am not sure in networking in ios… I do everything with swift, but I need good networking layer which would improve testing, code readability. basically I follow MVC-N(however will possible move to mvvm, because android i mvvm). Please share some code(please share swift and not third party resources)… I just recently bought subscription will hope to stay for long

@wellbranding Please check out this course when you get a chance:

https://www.raywenderlich.com/7476-networking-with-urlsession

I hope it helps!

1 Like

@wellbranding Thanks very much for your question, and welcome to the dark side! :slight_smile:

The link that @shogunkaramazov shared is an excellent course offered by our team, and I highly recommend it. Moreover, I would also like to share with you a link to the documentation page for URLSession which can be found here. This should give a good reference to the networking API found in Swift.

I hope this helps!

All the best!

@syedfa @shogunkaramazov I saw but it is not efficient… Networking should be done in separate class not in viewcontroller. I saw no examples for such cases… this is poor design pattern, and this website should use quality material. Also how should I handle responses both error and success response in a generic way? I am started to get a little adisappointed.

@wellbranding My apologies for the delayed response:

You are correct in that for good architecture, networking code should be in a separate class and not reside within the ViewController. Here is a link to a video course that teaches among other design patterns, the MVC-N architecture which you referenced above. I apologize for not being able to provide a free resource from our site, but as I said, the course that we provide, along with some of the books that we sell in our store do cover this topic.

I hope this helps!

All the best!

1 Like

This topic was automatically closed after 166 days. New replies are no longer allowed.