Chapter 8
Loading and Parsing Network Data

All this time, we’ve sort of been working our podcast app backwards: instead of parsing a feed, finding episodes, and playing one, we started with the player. This gave us a chance to play around with building user interfaces, but now it’s time to do the heavy lifting.

Think about what a podcast app does: it goes out to the network and fetches a list of episodes for one or more podcast feeds. Each of those must contain the metadata (titles, dates, etc.) and a URL for the audio. This metadata is in some structured form—by convention, podcasts use XML with a specific set of tags—so the client needs to parse this data, looking through the structured data for the parts it needs. From that, it can build a user interface showing the podcast feeds, and let the user interact with it.

In this chapter, our task will be to download a podcast feed from the network, and to parse its contents into a format that’s convenient for our Swift code to work with. We’ll see what the iOS SDKs offer for each of these tasks and what parts we have to handle ourselves.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset