Over a million developers have joined DZone.

How to Achieve iOS Networking Proficiency in 10 Steps

Most iOS apps require at least some kind of network connectivity for data transfer, which means network programming is an important area to master as an iOS developer. Here are ten steps to help you achieve excellence.

· Mobile Zone

ausios_comic2

Most iOS apps require at least some kind of network connectivity for data transfer, which means network programming is an important area to master as an iOS developer.

How to get on the path toward mastery?

I’ve found that the best approach to a learning topic in iOS — or programming in general — is to look at the topic from several different angles.

So in the spirit of viewing things with a wide perspective (rather than merely searching for “best practices”) I present to you 10 steps that can help you kick ass at iOS network programming:

Step #1

Watch the WWDC videos Network Apps for iPhone OS Part 1 and Part 2 where Quinn “The Eskimo” discusses best practices for building iOS network apps. Even though this talk is from 2010, it is still very relevant. Especially the segments about designing your UI properly for handling network failures, using asynchronous network requests, and run loops. (Note: for some reason Apple’s streaming version is not working, so you may have to click “Resources” and then download the video. It’s worth it!)

Step #2

Read Designing for Real World Networks to get an idea of how networks can be unpredictable and how Apple suggests you prepare for this. Most importantly, make the Network Link Conditioner tool your friend.

Step #3

Read Adding an API-Backed UIPageViewController in Swift by Christina Moulton to learn from a full working example of how UI code interacts with a backend API.

Step #4

Download and learn how to use Charles Proxy or another proxy software so that you can debug network apps. These proxy tools allow you to see the network requests that your app is making at any given time while it runs.

Step #5

Read NSURLSession : Getting Started go through a tutorial that uses Apple’s official networking API.

Step #6

Read Ash Furrow’s MVVM in Swift to learn an alternative way of architecting your app from conventional MVC, and how calling the network fits into this architecture.

Step #7

Watch Chris Eidhof’s talk on Tiny networking in Swift to see how you can leverage features in Swift to make networking in iOS simpler but also more powerful, without relying on a heavyweight networking library.

Step #8

Read Introduction to the Sockets API by Mike Ash to get a deeper look at sockets in iOS and how the low-level sockets API works under the hood.

Step #9

Check out my own article on how to quickly get a Python backend API and connect it with your Swift code — The Backwards Backend Technique.

Step #10

Gain proficiency in a tool that you can use to test network APIs, like cURL, httpie, or Postman.

Topics:
requests ,ios ,network ,asynchronous ,low-level ,backend ,api ,apps ,swift

Published at DZone with permission of Moe Burney, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}