Better Programming

Advice for programmers.

Member-only story

Using SwiftUI View Modifiers to Display Empty State

Peter Friese
Better Programming
Published in
3 min readDec 14, 2021

--

Image by the author, based on SF Symbols

Empty state is an important aspect of UX — it’s what users see when they first open your app, and as the saying goes, there is no second chance to leave a first impression — so it better be good. Showing users a meaningful empty state will make them feel welcome and is a great opportunity for you to educate them about how to get started with the app.

So far, Make It So doesn’t display a meaningful empty state, and in this article, we will look at a couple of options to implement this.

What we’re going to build

To get started, let’s take a look at Apple’s Reminder app (since this is the app that we’re trying to replicate):

Empty State in Apple’s Reminders App

A simple way to implement empty state is to use Xcode’s Make Conditional refactoring ( CMD + Click on a view, then choose Make Conditional). This will wrap the view in an if ... else statement and wrap the entire structure in a VStack:

--

--

Peter Friese
Peter Friese

Written by Peter Friese

Google Developer Advocate with the Firebase team 🔥