How to Handle Empty States Using UIContentUnavailableConfiguration
No more excuses to neglect empty states in your apps.
This article is originally published at swiftsenpai.com
In this year WWDC (WWDC23), Apple surprised developers with an unexpected improvement to UIKit. The introduction of UIContentUnavailableConfiguration
aimed to simplify the process of creating empty states for view controllers.
According to Apple, UIContentUnavailableConfiguration
is a composable description of an empty state and can be provided with placeholder content, such as an image or text.
Here’s an example of an empty state showcased in WWDC:
Now, let’s get into the details.
Note:
This article primarily focuses on the UIKit side of things. If you’re interested in learning how to do the same thing in SwiftUI, I recommend checking out this article by Antoine van der Lee.