Chapter 9
Web Services
It is difficult to build an application today without connecting to at least one web server or API. This chapter covers recipes that can be used to connect to those services, parse the information that is returned, and deal with things like checking network connectivity.
The topics covered in this chapter are
- Parsing JSON
- Parsing XML
- Making HTTP Calls
- Checking for Network Connectivity
- Calling a REST API
- Posting Data to a REST API
9-1. Parsing JSON
Problem
You need to parse JSON data to use it in your application.
Solution
Use the class NSJSONSerialization to parse JSON.
How It Works
JSON is a common format used in web services and APIs today. JSON stands for “JavaScript Object Notation.” JSON is a common data interchange ...
Get Swift Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.