Top five iOS libraries every iOS developer should know about, Infinum
Top five iOS libraries every iOS developer should know about
You very likely know that using third-party libraries in your iOS projects can save you a lot of time and hassle. The question is, which libraries are worth using? Read on and find out!
Services like GitHub or Bitbucket are utter of useful third-party libraries that can be lightly integrated into your project by using instruments like CocoaPods and Carthage. Here are five libraries that we use in every-day development and think every iOS developer should know about.
1. AFNetworking
When it comes to networking, this library makes every developer’s life a entire lot lighter. AFNetworking is a light-weight and swift networking library that uses blocks and GCD (Grand Central Dispatch).
It is a superb example of how an open-source project should be run, largely thanks to its creator Mattt Thompson, the founder and former writer on NSHipster. An amazing community of developers contributes to AFNetworking daily, making it the most popular third-party iOS library.
To see just how effortless it is to use it, check out the code example below:
GET request
POST request
Swift alternative
Two. JSONModel
If you are working on an app that requires communication with a remote server, chances are you'll get a JSON response. This is where JSONModel comes to the rescue.
JSONModel is an open-source library that helps you with parsing and initializing your model classes with JSON response from the server. When it comes to applications with a more elaborate data model, JSONModel proves to be a real time-saver.
Initializing model from JSON response
Swift alternative
ObjectMapper – this framework written in Swift simplifies the conversion of Model objects (Classes and Structs) to JSON and vice versa
Three. MagicalRecord
The Core Data API is used by iOS developers to persist and query user data. While powerful, using its API can also be fairly time-consuming and contain a lot of boilerplate code.
Fortunately, you can help yourself by using a library called MagicalRecord, a wrapper around Core Data that simplifies managing your persistence storage. It was inspired by the ease of Ruby on Rails' Active Record fetching and it permits you to:
- Clean up your Core Data related code
- Use ordinary, one-line fetches
- Modify the NSFetchRequest when request optimizations are needed
Let's see how we can put MagicalRecord to use:
Create an object
Retrieve all records for the NSManagedObject subclasses
Updating an entity
Delete single record
Swift alternative
SugarRecord – a data management library designed to make working with CoreData and Sphere simpler
Four. SDWebImage
AFNetworking has a excellent category to blast photos from the web (UIImageView+AFNetworking), but there's a library even more suited to this task.
SDWebImage specializes in pic downloading and caching, and offers an extensive list of features:
- A UIImageView category adding web pic and cache management to the Cocoa Touch framework
- An asynchronous photo downloader
- An asynchronous memory + disk pic caching with automatic cache expiration treating
- Animated GIF support
- Background photo decompression
- Assures that the same URL won't be downloaded several times
- Assures that bogus URLs won't be retried again and again
- Assures that the main thread will never be blocked
Here is a basic example of usage:
Fountain remote photo using blocks
Swift alternative
Kingfisher – lightweight and unspoiled Swift implemented library for downloading and caching pics from the web
Five. ReactiveCocoa
Objective-C framework inspired by functional programming. It provides methods to compose and convert rivulets of values. It functions by using signals (RACSignal) that capture present and future values. You can observe and update values by chaining, combining and reacting to signals.
A major advantage of ReactiveCocoa is that it provides a way to deal with asynchronous behaviors, including delegate methods, callback blocks, target-action mechanisms, notifications and KVO, simply by using signals.
Basic usage
Check if the email length is greater than 0, password length greater than 8, and enable the login button if both requirements are met.
ReactiveCocoa has grown to be fairly a big chunk of library, and I recommend that you check its GitHub page to see everything it can do.
Swift alternative
ReactiveCocoa v3.0 will contain a brand fresh Swift API. You can learn more in this good blog post written by Scott Logic.
Top five iOS libraries every iOS developer should know about, Infinum
Top five iOS libraries every iOS developer should know about
You very likely know that using third-party libraries in your iOS projects can save you a lot of time and hassle. The question is, which libraries are worth using? Read on and find out!
Services like GitHub or Bitbucket are utter of useful third-party libraries that can be lightly integrated into your project by using implements like CocoaPods and Carthage. Here are five libraries that we use in every-day development and think every iOS developer should know about.
1. AFNetworking
When it comes to networking, this library makes every developer’s life a entire lot lighter. AFNetworking is a light-weight and rapid networking library that uses blocks and GCD (Grand Central Dispatch).
It is a good example of how an open-source project should be run, largely thanks to its creator Mattt Thompson, the founder and former writer on NSHipster. An amazing community of developers contributes to AFNetworking daily, making it the most popular third-party iOS library.
To see just how effortless it is to use it, check out the code example below:
GET request
POST request
Swift alternative
Two. JSONModel
If you are working on an app that requires communication with a remote server, chances are you'll get a JSON response. This is where JSONModel comes to the rescue.
JSONModel is an open-source library that helps you with parsing and initializing your model classes with JSON response from the server. When it comes to applications with a more elaborate data model, JSONModel proves to be a real time-saver.
Initializing model from JSON response
Swift alternative
ObjectMapper – this framework written in Swift simplifies the conversion of Model objects (Classes and Structs) to JSON and vice versa
Trio. MagicalRecord
The Core Data API is used by iOS developers to persist and query user data. While powerful, using its API can also be fairly time-consuming and contain a lot of boilerplate code.
Fortunately, you can help yourself by using a library called MagicalRecord, a wrapper around Core Data that simplifies managing your persistence storage. It was inspired by the ease of Ruby on Rails' Active Record fetching and it permits you to:
- Clean up your Core Data related code
- Use elementary, one-line fetches
- Modify the NSFetchRequest when request optimizations are needed
Let's see how we can put MagicalRecord to use:
Create an object
Retrieve all records for the NSManagedObject subclasses
Updating an entity
Delete single record
Swift alternative
SugarRecord – a data management library designed to make working with CoreData and Area simpler
Four. SDWebImage
AFNetworking has a superb category to blast pictures from the web (UIImageView+AFNetworking), but there's a library even more suited to this task.
SDWebImage specializes in picture downloading and caching, and offers an extensive list of features:
- A UIImageView category adding web pic and cache management to the Cocoa Touch framework
- An asynchronous picture downloader
- An asynchronous memory + disk photo caching with automatic cache expiration treating
- Animated GIF support
- Background picture decompression
- Assures that the same URL won't be downloaded several times
- Assures that bogus URLs won't be retried again and again
- Assures that the main thread will never be blocked
Here is a basic example of usage:
Stream remote pic using blocks
Swift alternative
Kingfisher – lightweight and unspoiled Swift implemented library for downloading and caching photos from the web
Five. ReactiveCocoa
Objective-C framework inspired by functional programming. It provides methods to compose and convert flows of values. It functions by using signals (RACSignal) that capture present and future values. You can observe and update values by chaining, combining and reacting to signals.
A major advantage of ReactiveCocoa is that it provides a way to deal with asynchronous behaviors, including delegate methods, callback blocks, target-action mechanisms, notifications and KVO, simply by using signals.
Basic usage
Check if the email length is greater than 0, password length greater than 8, and enable the login button if both requirements are met.
ReactiveCocoa has grown to be fairly a big lump of library, and I recommend that you check its GitHub page to see everything it can do.
Swift alternative
ReactiveCocoa v3.0 will contain a brand fresh Swift API. You can learn more in this good blog post written by Scott Logic.