Working with JSON, Slider and Data Filtering
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.
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.
To access the full content and the complete source code, please get your copy at https://www.appcoda.com/swiftui.