Demo.swift
ContentView.swift
App.swift
import SwiftUI
struct SectionFormDemo: View {
@State private var name = ""
@State private var notifications = true
var body: some View {
Form {
Section(header: Text("Profile"), footer: Text("Shown to others")) {
TextField("Name", text: $name)
}
Section(header: Text("Preferences")) {
Toggle("Notifications", isOn: $notifications)
}
}
}
}
import SwiftUI
struct ContentView: View {
var body: some View { SectionFormDemo() }
}
import SwiftUI
@main
struct MyApp: App {
var body: some Scene { WindowGroup { ContentView() } }
}