Skip to content

Commit 018b646

Browse files
committed
Add form playground
1 parent e5f1230 commit 018b646

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#if canImport(AndroidSwiftUI)
2+
import AndroidSwiftUI
3+
#else
4+
import SwiftUI
5+
#endif
6+
7+
struct FormPlayground: View {
8+
@State private var wifi = true
9+
@State private var bluetooth = false
10+
@State private var brightness = 0.6
11+
@State private var name = ""
12+
var body: some View {
13+
Form {
14+
Section("Connectivity") {
15+
Toggle("Wi-Fi", isOn: $wifi)
16+
Toggle("Bluetooth", isOn: $bluetooth)
17+
}
18+
Section(header: "Display", footer: "Drag to adjust the screen brightness.") {
19+
Slider(value: $brightness, in: 0...1)
20+
HStack { Text("Level"); Spacer(); Text("\(Int(brightness * 100))%") }
21+
}
22+
Section("Account") {
23+
TextField("Name", text: $name)
24+
HStack { Text("Status"); Spacer(); Text(name.isEmpty ? "Guest" : name) }
25+
}
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)