Skip to content

SwiftUI forms

SwiftUI provides several form controls that we can use to get input from the user.

Think about the Settings app on your iPhone.

That app can be built using the built-in form controls that we’re going to soon see, like:

All of those are going to be wrapped in a Form view:

Form {

}

This tells SwiftUI that this is a form, and SwiftUI will present the content in a way that it conforms to how a form should look, on the specific platform you run it on (iPhone, Mac, Watch..).

This is part of the declarative aspect of SwiftUI. We wrap our form controls in a Form view to tell it it’s a form, then it makes decisions for us.

We’ll see more about forms by covering each individual form control.


→ Get my Swift Handbook

→ I wrote 17 books to help you become a better developer:

  • C Handbook
  • Command Line Handbook
  • CSS Handbook
  • Express Handbook
  • Git Cheat Sheet
  • Go Handbook
  • HTML Handbook
  • JS Handbook
  • Laravel Handbook
  • Next.js Handbook
  • Node.js Handbook
  • PHP Handbook
  • Python Handbook
  • React Handbook
  • SQL Handbook
  • Svelte Handbook
  • Swift Handbook
...download them all now!

Also, JOIN MY CODING BOOTCAMP, an amazing cohort course that will be a huge step up in your coding career - covering React, Next.js - next edition February 2025

Bootcamp 2025

Join the waiting list