Skip to content

Commit 307e2cd

Browse files
committed
Add more controls playground
1 parent 662f9b1 commit 307e2cd

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#if canImport(AndroidSwiftUI)
2+
import AndroidSwiftUI
3+
#else
4+
import SwiftUI
5+
#endif
6+
7+
struct MoreControlsPlayground: View {
8+
@State private var quantity = 1
9+
@State private var password = ""
10+
@State private var choice = "None"
11+
var body: some View {
12+
ScrollView {
13+
VStack(alignment: .leading, spacing: 0) {
14+
Example("Stepper") {
15+
Stepper("Quantity: \(quantity)", value: $quantity, in: 0...10)
16+
}
17+
Example("SecureField") {
18+
VStack(alignment: .leading, spacing: 8) {
19+
SecureField("Password", text: $password)
20+
Text(password.isEmpty ? "Nothing typed yet" : "\(password.count) characters")
21+
}
22+
}
23+
Example("Menu") {
24+
VStack(alignment: .leading, spacing: 8) {
25+
Menu("Actions") {
26+
Button("Rename") { choice = "Rename" }
27+
Button("Duplicate") { choice = "Duplicate" }
28+
Button("Delete") { choice = "Delete" }
29+
}
30+
Text("Chose: \(choice)")
31+
}
32+
}
33+
}
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)