The best APIs and libraries for iOS developers

The best APIs and libraries for iOS developers
The best APIs and libraries for iOS developers

BBVA API Market

Although the Apple systems development world is in the process of mutating from Objective-C to Swift, both languages will be able to coexist for years in the source code bases of applications. Programmers will be able to choose the APIs, frameworks and systems that best suit their needs in both languages. Let’s review some APIs and libraries that are useful for development with iOS.

MagicalRecord

Although Core Data may seem simple, it can turn out to be complicated even for projects at the embryonic stage, as it creates a lot of extra base code.

Create, delete and update entities, store the context, create different Core Data states for different environments. MagicalRecord solves all this by creating a wrapper around Core Data that hides everything that is not relevant. Similar to how Active Record works in Ruby on Rails, which is its inspiration, Magical Record lets you create fetches in a simple and concise way, while maintaining all the power and flexibility to use NSFetchRequest when needed.

For example, to get an alphabetically sorted list of people who are persistently stored, we just have to write this line:

NSArray *gente = [Person MR_findAllSortedBy:@”Nombre” ascending:YES];

If you prefer Swift, you can use SugarRecord.

ObjectMapper

When communicating with different online APIs, one of the most tedious and repetitive tasks is to code-map responses to the objects with which we are going to use the data. ObjectMapper is very useful for resolving this point as it converts JSON to objects and vice versa in a simple way.

An example with a class that manages the temperature data of an API for chemical elements data.

struct Temperatura: Mappable {

     var grados: Double?

     var kelvin: Double?

     init?(_ map: Map) {

     }

     mutating func mapping(map: Map) {

     grados     <- map[“grados”]

     kelvin  <- map[“kelvin”]

     }

}

If you prefer Swift, you can use Alamofire Object Mapper.

CloudRail API

The Cloud Storage API is a library capable of unifying various cloud storage systems in which to manage data. But in iOS, it goes much further. CloudRail SI expands its functions with multiple facets: social network interfaces, payment methods, email management and even SMS.

Cloud storage methods, for example, make it possible to abstract, technically, the traditional methods of uploading, downloading, copying and moving data in different popular providers. For example, downloading a file from Dropbox with Swift is as simple as:

CRCloudRail.setAppKey (“CLAVE\_API\_CLOUDRAIL”)

let cloudStorage : CloudStorageProtocol = Dropbox.init(clientId: “ClientID”, clientSecret: “ClientSecret”)

do{

  let inputStream = try cloudStorage.downloadFileWithPath(“/imagen.jpeg”)

} catch let error{

  print(“Ha ocurrido un error: (error)”)

}

And managing social networks is just as simple as in CloudRail. An example of sending a public message to Facebook:

CRCloudRail.setAppKey(“CLAVE\_API\_CLOUDRAIL”)

let social = Facebook(clientID: “\[clientID]“, clientSecret: “\[clientSecret]“)

do{

try social.postUpdateWithContent(“Contenido del mensaje”)

} catch let error{

                print(“Ha ocurrido un error: (error)”)”

}

Finally, we can use CloudRail to connect directly to the Stripe or Paypal payment APIs, or use CloudRail’s JSON management APIs to access BBVA’s Customer API. With this, an iOS application will be able to manage the personal information and payments of BBVA customers and users.

By combining the Customers API with the Payments API developers can improve their payment methods in simple steps. Managing information about the customer before payment is made can help to increase efficiency and improve the conversion rate.

To request the information, just send a POST request with two specific HTTP headers:To request the information, just send a POST request with two specific HTTP headers:

Authorization: Basic CREDENCIALES_DE_TU_APP

Content-Type: application/json

POST https://connect.bbva.com/token?grant_type=authorization_code&code=YOURCODE&redirect_uri=YOURREDIRECTURI

You can use JSON Model, one of the oldest iOS libraries, to manage BBVA Customers or BBVA Payments data in JSON without having to repeat your code.

Interested in financial APIs? Discover all the ones BBVA offers you

It may interest you