Libraries, we all know them and we all use them. They make our life as developers easier and let us win days of precious dev-time. In this post I would like to guide you through my personal top 5 Objective-C libraries.
Let’s get started with number one:
AFNetworking, Who didn’t see that coming? Today an app without networking is unthinkable. Moreover, to implement it is and stays hard to do! There are quite some concepts and parts you need to understand in order to make it work.
This library is built on top of the Foundation URL Loading System and has been developed by Mattt Thompson AKA NSHipster. It has an easy to use API for iOS and Mac OS X that contains everything you need to interact with your webservices. It also helps out in several UI-related components such as loading an image inside a UIImageView all handled for you on a different thread. Nothing to worry about.
There are definitely several other networking libraries out there, but AFNetworking will fit each application. It is lightweight, fast, well-documented and contributed to each day.
Number 2, Mantle, is a model framework that provides a way to create objects from your freshly received JSON and the other way around. This, in combination with AFNetworking, is my personal favorite. It can easily handle objects like NSDate, NSURL, NSString, NSNumber, etc. You can even plug in your own transformers and get that NSDate the way you want it formatted.
If you are looking for a well-suited mapping framework, this is the answer!
Autolayout can be a drag, I myself struggled a long time with the ugly-to-use AutoLayout code, but when I discovered Masonry I immediately fell in love with it. Masonry provides a way to write AutoLayout code with a nicer syntax thanks to its fluent API-style but also makes debugging constraints more comfortable. Talk with every iOS/Mac developer and they will tell you the same thing: “AutoLayout, meh… I’ll calculate those views positions on my own.”. But trust me, stop learning the ugly AutoLayout syntax and start using Masonry right away. You will be zen with it in no time!
If you already met Core Data, I think you can confirm that it was hard to learn. Besides knowing all the essential CoreData objects like NSManagedObjectContext, NSManagedObjectModel, etc. you also need to know how they work together. After you managed that, you still need to write a lot of code and maintain it. Also, think about a multithreaded context and its consequences.
This library provides several classes and categories built over the existing CoreData framework to make your day a little brighter again.
Last but definitely not least: Reliant, a dependency injection framework for Objective-C written by our own @mikeseghers. Yes, I must admit DI is a 25-dollar term for a 5-cent concept, but it rocks so hard in keeping your code clean and making your life easier.
If you are not familiar with the DI concept, please allow me to explain so that even a five-year-old can understand.
Imagine yourself as a kid, always hungry and up for sugar. The first solution is to walk to the refrigerator and take the food out yourself. But that can cause problems. You could forget to close the door or you might get something that mommy and daddy won’t appreciate. What you SHOULD do is state that you are hungry and in need for food. Reliant will solve this, it will act like a good father/mother and provide you with food and solve your first world problems.
Without DI, your objects are responsible for obtaining their own references. When applying Reliant, the objects are given their references(dependencies) at creation time by some external configuration that coordinates each object(dependency) in the system. In other words, dependencies are injected into objects. By using other object oriented best practices, you will be able to decouple your objects from each other, which in turn makes them more testable.
Definitely check out this library and please feel free to speak your mind.
That’s about it, my top 5 Objective-C libraries! Let’s wrap this post up and keep on thanking the open-source community for their hard work