Skip to content

Commit 5240b06

Browse files
committed
Document UIKitBackend menu item ordering
1 parent 5b6a37f commit 5240b06

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

Examples/Sources/CounterExample/CounterApp.swift

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import DefaultBackend
2+
import Foundation
23
import SwiftCrossUI
34

45
#if canImport(SwiftBundlerRuntime)
@@ -9,20 +10,45 @@ import SwiftCrossUI
910
@HotReloadable
1011
struct CounterApp: App {
1112
@State var count = 0
13+
@State var theme: ColorScheme = .dark
14+
15+
@Environment(\.openURL) var openURL
1216

1317
var body: some Scene {
1418
WindowGroup("CounterExample: \(count)") {
1519
#hotReloadable {
16-
HStack(spacing: 20) {
17-
Button("-") {
18-
count -= 1
19-
}
20-
Text("Count: \(count)")
21-
Button("+") {
22-
count += 1
20+
ZStack {
21+
theme == .dark ? Color.black : Color.white
22+
23+
VStack {
24+
HStack(spacing: 20) {
25+
Button("-") {
26+
count -= 1
27+
}
28+
Text("Count: \(count)")
29+
Button("+") {
30+
count += 1
31+
}
32+
}
33+
.padding()
34+
35+
Menu("Settings") {
36+
Text("Current theme: \(theme)")
37+
Menu("Theme") {
38+
Button("Light") {
39+
theme = .light
40+
}
41+
Button("Dark") {
42+
theme = .dark
43+
}
44+
}
45+
Button("Open documentation") {
46+
openURL(URL(string: "https://stackotter.dev")!)
47+
}
48+
}
2349
}
2450
}
25-
.padding()
51+
.colorScheme(.dark)
2652
}
2753
}
2854
.defaultSize(width: 400, height: 200)

0 commit comments

Comments
 (0)