Skip to content

Instantly share code, notes, and snippets.

@timsneath
Created September 22, 2023 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timsneath/3807696d2b27579232377078f00bf102 to your computer and use it in GitHub Desktop.
Save timsneath/3807696d2b27579232377078f00bf102 to your computer and use it in GitHub Desktop.
Replace the default `ContentView` struct with this...
struct ContentView: View {
@State private var switchSetting = true
@State private var stepperValue = 11
@State private var dateValue = Date.now
var body: some View {
NavigationView {
Form {
Section {
Toggle("On or off: you choose", isOn: $switchSetting)
Stepper(value: $stepperValue, in: 0...11)
{ Text("Awesomeness: \(stepperValue)")}
DatePicker(selection: $dateValue, label: { Text("Date") })
}
header: {
Text("First Section")
}
footer: {
Text("This section contains some useful settings.")
}
Section {
Text("Hello, world!")
Text("Hello, world!")
Text("Hello, world!")
Text("Hello, world!")
}
header: {
Text("Second Section")
}
}
.navigationTitle("SwiftUI Config Demo")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment