Chapter 21
Working with JSON, Slider and Data Filtering

JSON, short for JavaScript Object Notation, is a common data format for data interchange in client-server application. Even though we are mobile app developers, it's inevitable to work with JSON since nearly all web APIs or backend web services use JSON as the data exchange format.

In this chapter, we will discuss how you can work with JSON while building an app using the SwiftUI framework. If you do not have any ideas about JSON, I would recommend to check out this free chapter from our Intermediate programming book. It will explain to you in details the two different approaches in handling JSON in Swift.

Figure 1. The demo app
Figure 1. The demo app

As usual, in order to grasp the knowledge of JSON and its related APIs, you will build a simple JSON app that utilize a JSON-based API provided by Kiva.org. If you haven't heard of Kiva, it is a non-profit organization with a mission to connect people through lending to alleviate poverty. It lets individuals lend as little as $25 to help create opportunities around the world. Kiva provides free web-based APIs for developers to access their data. For our demo app, we'll call up a free Kiva API to retrieve the most recent fundraising loans and display them in a list view as shown in figure 1.

On top of that, we will demonstrate the usage of a Slider, which is one of the many built-in UI controls provided by SwiftUI. You will implement a data filtering option in the app so that users can filter the loan data in the list.

Figure 2. A slider control
Figure 2. A slider control

To access the full content and the complete source code, please get your copy at https://www.appcoda.com/swiftui.

results matching ""

    No results matching ""