Skip to content

Instantly share code, notes, and snippets.

@ppeelen
Created May 4, 2024 11:06
Show Gist options
  • Save ppeelen/ecc147a93cdabfb48c81a133112f4edb to your computer and use it in GitHub Desktop.
Save ppeelen/ecc147a93cdabfb48c81a133112f4edb to your computer and use it in GitHub Desktop.
The result of the GeneralSettingsView swift file.
import SwiftUI
struct GeneralSettingsView: View {
@State private var settingOneValue = false
@State private var settingTwoValue = false
@State private var settingThreeValue = false
var body: some View {
Form {
Section {
Toggle(isOn: $settingOneValue, label: {
VStack(alignment: .leading) {
Text("Title")
.font(.title2)
Text("Subtitle for the setting, explaining what it does")
}
})
} header: {
Text("Section 1")
}
Section {
Toggle(isOn: $settingTwoValue, label: {
VStack(alignment: .leading) {
Text("Title 2")
.font(.title2)
Text("Subtitle for the setting, explaining what it does")
}
})
Toggle(isOn: $settingThreeValue, label: {
VStack(alignment: .leading) {
Text("Title 3")
.font(.title2)
Text("Subtitle for the setting, explaining what it does")
}
})
} header: {
Text("Section two")
}
}
.formStyle(.grouped)
.frame(width: 800, height: 600)
}
}
#Preview {
GeneralSettingsView()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment