File tree Expand file tree Collapse file tree 1 file changed +8
-32
lines changed
Examples/Sources/CounterExample Expand file tree Collapse file tree 1 file changed +8
-32
lines changed Original file line number Diff line number Diff line change 1
1
import DefaultBackend
2
- import Foundation
3
2
import SwiftCrossUI
4
3
5
4
#if canImport(SwiftBundlerRuntime)
@@ -10,45 +9,22 @@ import SwiftCrossUI
10
9
@HotReloadable
11
10
struct CounterApp : App {
12
11
@State var count = 0
13
- @State var theme : ColorScheme = . dark
14
-
15
- @Environment ( \. openURL) var openURL
16
12
17
13
var body : some Scene {
18
14
WindowGroup ( " CounterExample: \( count) " ) {
19
15
#hotReloadable {
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
- }
16
+ VStack {
17
+ HStack ( spacing: 20 ) {
18
+ Button ( " - " ) {
19
+ count -= 1
32
20
}
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
- }
21
+ Text ( " Count: \( count) " )
22
+ Button ( " + " ) {
23
+ count += 1
48
24
}
49
25
}
26
+ . padding ( )
50
27
}
51
- . colorScheme ( . dark)
52
28
}
53
29
}
54
30
. defaultSize ( width: 400 , height: 200 )
You can’t perform that action at this time.
0 commit comments