Member-only story
Meet & Greet — Advanced Lists in SwiftUI
Implement a dynamic list with empty, error, and loading state
Update 2019/08/14: Now available as a Swift package 🚀
Motivation
What do I mean by advanced list?
The app I’m currently working on has many dynamic lists which can represent different states, such as empty
, error
, items
or loading
.
I implemented a solution, on top of the data-driven framework IGListKit, to be able to create these type of lists in our UIKit app.
Now, I wanted to implement something similar using SwiftUI. Just a few lines of code, right?
Implementation
In this section, we will take a look at my implementation and the different components I created.
ListState
The AdvancedList
should be able to represent different states. We can easily define the states with an Enum
.
You will see below why I skipped adding an empty case.