
Make an app with several library dependencies - without the pain!
This is a post by iOS Tutorial Team Member Marcelo Fabri, an iOS, Python and Java developer working at Dextra Sistemas. Check out also his personal website.
In this tutorial, you’ll learn how to use a popular dependency management tool called CocoaPods.
But wait! What is a dependency management tool and why do you need one?
As an iOS developer, you certainly use a lot of code made by others, in the shape of libraries. You may not remember, but how complicated would your life be if you had to implement everything from scratch?
Usually (since building static libraries manually is sooooo boring), you just add the library code into your project. But that has some disadvantages:
- Code that could be somewhere else is stored in your repository, wasting space.
- Sometimes, it’s hard to get a specific version of a library.
- There’s no central place where you can see which libraries are available.
- Finding a new version of a library and updating your project with it is boring and sometimes, painful.
- Downloading libraries manually creates a tendency to perhaps make some changes to the downloaded code and just leaving it there (making updating harder, as you’ll need to merge the changes you made with the code you download for the next version).
A dependency management tool helps you overcome most of the issues mentioned above. It will resolve dependencies between the various libraries you use, fetch the source code for the dependencies, and creates and maintains the right environment for you to build your project with the minimum of hassles.
Coming from a JavaEE background, where Maven reigns as a dependency management tool, I longed for the day when I could just specify the library I needed (and optionally, the exact version) and have it installed/included for each project automatically.
That day finally arrived for me when I discovered CocoaPods :]
In this tutorial, you’ll get hands on experience using CocoaPods. Specifically, you’ll use it to create an app that connects to popular television information site trakt.tv and fetches information about the shows that you (or somebody else) subscribed to, allowing you to show information about upcoming television episodes.
As you’ll see in this tutorial, using CocoaPods will make this project a lot easier. Read on to see for yourself! :] Keep reading!