Skip to content

SwiftUI: Form

Form is a new kind of component introduced in SwiftUI and it can be used in your own setting page. Imagine going into the setting page on an app and the hassle just to create a setting page. With form, you will be able to render the whole page easily.

A container for grouping controls used for data entry, such as in settings or inspectors.

Apple Documentation

In this tutorial, you’ll learn what it takes to build Form in SwiftUI. You’ll learn:

  • How to build form.


To follow along this tutorial, you’ll need some basic knowledge in:

  • A basic familiarity with Swift.
  • At least Xcode 11


Go to Settings on your iPhone and you probably will have a rough idea how to build that in UIKit. Now, you will see a different approach in SwiftUI.

With Form, you will be able to integrate different component, be it Toggle, Picker or anything. Below, you will see a somewhat duplication of a iPhone setting page.

Form can contain as many section as you would like it to. You will now add another section to demonstrate the easiness of doing it. Within the same Form, simply add a Section to indicate a different group.

Add the following code inside Form.

What?! They said it will be easy but I never thought it would be this easy!

Where to go From Here

If you feel like you are ready to take on more challenges, feel free to check out some other tutorials that we have created:

Published inSwiftUI

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *