How to Handle Empty States Using UIContentUnavailableConfiguration

No more excuses to neglect empty states in your apps.

Lee Kah Seng
6 min readJun 12, 2023

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 UIContentUnavailableConfigurationaimed 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:

Source: What’s new in UIKit

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.

Creating a UIContentUnavailableConfiguration

--

--