<!--
{
  "availability" : [
    "macOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Settings",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI8SettingsV"
  },
  "title" : "Settings"
}
-->

# Settings

A scene that presents an interface for viewing and modifying an app’s
settings.

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

## Overview

Use a settings scene to have SwiftUI manage views with controls for your
app’s settings when you declare your app using the [`App`](/documentation/SwiftUI/App) protocol.
When you use an [`App`](/documentation/SwiftUI/App) declaration for multiple platforms, compile the
settings scene only in macOS:

```
@main
struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
        #if os(macOS)
        Settings {
            SettingsView()
        }
        #endif
    }
}
```

Passing a view as the argument to a settings scene in the [`App`](/documentation/SwiftUI/App)
declaration causes SwiftUI to enable the app’s Settings menu item.
SwiftUI manages displaying and removing the settings view when the user
selects the Settings item from the application menu or the equivalent
keyboard shortcut:

![A screenshot of the MyApp application menu, showing the active](images/com.apple.SwiftUI/SwiftUI-AppBehavior-Settings-AppMenu@2x.png)

The contents of your settings view are controls that modify bindings
to <doc://com.apple.documentation/documentation/Foundation/UserDefaults>
values that SwiftUI manages using the [`AppStorage`](/documentation/SwiftUI/AppStorage) property wrapper:

```
struct GeneralSettingsView: View {
    @AppStorage("showPreview") private var showPreview = true
    @AppStorage("fontSize") private var fontSize = 12.0

    var body: some View {
        Form {
            Toggle("Show Previews", isOn: $showPreview)
            Slider(value: $fontSize, in: 9...96) {
                Text("Font Size (\(fontSize, specifier: "%.0f") pts)")
            }
        }
    }
}
```

You can define your settings in a single view, or you can use a [`TabView`](/documentation/SwiftUI/TabView)
to group settings into different collections:

```
struct SettingsView: View {
    var body: some View {
        TabView {
            Tab("General", systemImage: "gear") {
                GeneralSettingsView()
            }
            Tab("Advanced", systemImage: "star") {
                AdvancedSettingsView()
            }
        }
        .scenePadding()
        .frame(maxWidth: 350, minHeight: 100)
    }
}
```

![A screenshot showing a tabbed application settings view containing a](images/com.apple.SwiftUI/SwiftUI-AppBehavior-Settings@2x.png)

## Topics

### Creating a settings scene

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

Creates a scene that presents an interface for viewing and modifying
an app’s preferences.



---

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)