Essential Guide: The latest on enterprise architecture strategy
A comprehensive collection of articles, videos and more, hand-picked by our editors
The standard format connecting APIs with a device is through using a JSON constructed package. A JSON framework...
Apple's iOS now supports Objective-C and Swift as two different development languages that can be used to create solutions. The good news is that you can use frameworks written in either language and shared across projects. This means that you can use older Objective-C frameworks in a Swift project. There are essentially two steps to connecting to a JSON framework for iOS: First, identify the API that will be utilized, and then parse the JSON.
Connecting to JSON API
Connecting to an API is the first step needed to pull an API into the project you are working on in Xcode. The NSJSONSerialization Class is required to connect to an API. The class works for both Objective-C and Swift.
How to parse JSON with Frameworks for iOS
- JSONModel -- an Objective-C framework
- JSONAPI-ios -- an Objective-C framework
- ObjectMapper -- a Swift framework
- Spine -- a Swift framework
- SwiftyJSON -- a Swift framework
But do you need a JSON framework for everything? It depends on the type of project you are developing. The recommendation is to use a framework if you are extending an older Objective-C project. For a new, Swift 2.0 project you do not need to use a framework. The code is not too complex. Roadfire Software has a great tutorial to get you started.
What to do next?
Up to this point, a project is both connected to an API and has parsed the data. Now what? This is the fun part. Now you can manage the data how you like in an Xcode project. This may include mapping directions, connecting business processes or any of the thousands of public and private APIs available to iOS developers. The speed with which a solution you can create a project is exponentially increased through the use of APIs in iOS.
JSON format and XML coexists in APA's data strategy
Best practices when pairing REST with JSON
Related Q&A from Matthew David
Developers who use Xcode 8 have been faced with a choice: Make the jump to Swift 3.0 or simply upgrade to Swift 2.3. Here's what developers should ...continue reading
In this article, mobile expert Matthew David walks developers through some of the most effective ways to connect to JSON APIs in an Android-based ...continue reading
Microservices can offer flexibility for developers, but should they be using it for mobile development? Matthew David offers his take.continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.