Chapter 7
Example: Writing an API-Driven App

It’s time for the main event. We’re going to put together everything we know about iOS development and write a complete app. This chapter will introduce only one topic we haven’t covered yet: sending and receiving information from the Internet via HTTP. Nowadays most software needs to communicate to an external service in some way, so this example is highly relevant to whatever you try to build. Since this isn’t a book on iOS design, we might not wind up with the prettiest software on a device, but it will do everything we need.

We’re going to build a mobile app for the Colr JSON API (http://www.colr.org/api.html). Our users can type in a color hex code (i.e., #3B5998) and then see what tags Colr users have assigned to that color. If our user is feeling particularly adventurous, they can even add a new tag!

Let’s talk about high-level architecture. When building a production app, it’s a good idea to break down all of the objects and classes we need to create. The app will have two controllers: a SearchController for searching and a ColorController to display detailed information about a color. These should be wrapped inside a UINavigationController, our top-level controller. We’re also going to need some models for our data: Color and Tag.

Now that we have a good idea of what code to write, let’s set up our project.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset