O'Reilly logo

Swift Essentials by Dr. Alex Blewitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Parsing Networked Data

Many iOS applications need to communicate with other servers or devices. This chapter presents both HTTP and non-HTTP networking in Swift and how data can be parsed from either JSON or XML. It first demonstrates how to load data efficiently from URLs followed by how to stream larger data responses. It then concludes with how to perform both synchronous and asynchronous network requests over protocols other than HTTP.

This chapter will present the following topics:

  • Loading data from URLs
  • Updating the user interface from a background thread
  • Parsing JSON and XML data
  • Stream-based connections
  • Asynchronous data communication

Loading data from URLs

The most common way to load data from a remote network source is to use an HTTP ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required