<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Form",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4FormV"
  },
  "title" : "Form"
}
-->

# Form

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

```
nonisolated struct Form<Content> where Content : View
```

## Overview

SwiftUI applies platform-appropriate styling to views contained inside a
form, to group them together. Form-specific styling applies to
things like buttons, toggles, labels, lists, and more. Keep in mind that
these stylings may be platform-specific. For example, forms appear as
grouped lists on iOS, and as aligned vertical stacks on macOS.

The following example shows a simple data entry form on iOS, grouped into
two sections. The supporting types (`NotifyMeAboutType` and
`ProfileImageSize`) and state variables (`notifyMeAbout`, `profileImageSize`,
`playNotificationSounds`, and `sendReadReceipts`) are omitted for
simplicity.

```
var body: some View {
    NavigationView {
        Form {
            Section(header: Text("Notifications")) {
                Picker("Notify Me About", selection: $notifyMeAbout) {
                    Text("Direct Messages").tag(NotifyMeAboutType.directMessages)
                    Text("Mentions").tag(NotifyMeAboutType.mentions)
                    Text("Anything").tag(NotifyMeAboutType.anything)
                }
                Toggle("Play notification sounds", isOn: $playNotificationSounds)
                Toggle("Send read receipts", isOn: $sendReadReceipts)
            }
            Section(header: Text("User Profiles")) {
                Picker("Profile Image Size", selection: $profileImageSize) {
                    Text("Large").tag(ProfileImageSize.large)
                    Text("Medium").tag(ProfileImageSize.medium)
                    Text("Small").tag(ProfileImageSize.small)
                }
                Button("Clear Image Cache") {}
            }
        }
    }
}
```

![A form on iOS, presented as a grouped list with two sections. The](images/com.apple.SwiftUI/SwiftUI-Form-iOS@2x.png)

On macOS, a similar form renders as a vertical stack. To adhere to macOS
platform conventions, this version doesn’t use sections, and uses colons at
the end of its labels. It also sets the picker to use
the [`inline`](/documentation/SwiftUI/PickerStyle/inline) style, which produces radio buttons on macOS.

```
var body: some View {
    Spacer()
    HStack {
        Spacer()
        Form {
            Picker("Notify Me About:", selection: $notifyMeAbout) {
                Text("Direct Messages").tag(NotifyMeAboutType.directMessages)
                Text("Mentions").tag(NotifyMeAboutType.mentions)
                Text("Anything").tag(NotifyMeAboutType.anything)
            }
            Toggle("Play notification sounds", isOn: $playNotificationSounds)
            Toggle("Send read receipts", isOn: $sendReadReceipts)

            Picker("Profile Image Size:", selection: $profileImageSize) {
                Text("Large").tag(ProfileImageSize.large)
                Text("Medium").tag(ProfileImageSize.medium)
                Text("Small").tag(ProfileImageSize.small)
            }
            .pickerStyle(.inline)

            Button("Clear Image Cache") {}
        }
        Spacer()
    }
    Spacer()
}
```

![A form on iOS, presented as a vertical stack of views. At top, it shows](images/com.apple.SwiftUI/SwiftUI-Form-macOS@2x.png)

## Topics

### Creating a form

[`init(content:)`](/documentation/SwiftUI/Form/init(content:))

Creates a form with the provided content.

### Creating a form from a configuration

[`init(_:)`](/documentation/SwiftUI/Form/init(_:))

Creates a form based on a form style configuration.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)