Concise Forms: SwiftUI

Episode #131 • Jan 18, 2021 • Subscriber-Only

For simple forms, vanilla SwiftUI does a really good job: you can quickly build a form with many components in minimal code and boilerplate. But as a form becomes more complex, SwiftUI stops being so helpful. Let’s explore the problems that emerge and how we can work around them.

Form view hierarchy
Advanced form logic
Next time: the Composable Architecture

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.


Today we are going to focus on a small, but common problem when building applications and that is building forms. By forms we just mean a screen with lots editable fields, such as text fields, toggles, pickers, sliders and more. Such screens are very common for things like settings, log in, sign up and more.

It turns out that for simple, straightforward forms, vanilla SwiftUI does a really good job. There’s basically no boilerplate, and you can handle many form components at once with very little code. However, as the behavior of the form gets more complex, SwiftUI stops being as helpful, and you are forced to do some workarounds that are less than ideal.

These new complexities are what will drive us to look at what the Composable Architecture has to say about forms, but unfortunately the architecture has a few problems of its own when it comes to forms. Most notably, there is a bit of boilerplate involved.

However, it doesn’t have to be that way. Turns out there are some fancy tricks we can employ to regain all the conciseness that SwiftUI gives us while allowing us to build the feature in the Composable Architecture so that we get all of its benefits, such as explicit side effects and testability.

This episode is for subscribers only.

Subscribe to Point-Free

Access this episode, plus all past and future episodes when you become a subscriber.

See plans and pricing

Already a subscriber? Log in