File tree Expand file tree Collapse file tree 3 files changed +41
-1
lines changed
Sources/SimpleGridExample Expand file tree Collapse file tree 3 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -54,3 +54,8 @@ version = '0.1.0'
5454identifier = ' dev.swiftcrossui.PathsExample'
5555product = ' PathsExample'
5656version = ' 0.1.0'
57+
58+ [apps .SimpleGridExample ]
59+ identifier = ' dev.swiftcrossui.SimpleGridExample'
60+ product = ' SimpleGridExample'
61+ version = ' 0.1.0'
Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ let package = Package(
6868 . executableTarget(
6969 name: " PathsExample " ,
7070 dependencies: exampleDependencies
71- )
71+ ) ,
72+ . executableTarget(
73+ name: " SimpleGridExample " ,
74+ dependencies: exampleDependencies
75+ ) ,
76+
7277 ]
7378)
Original file line number Diff line number Diff line change 1+ import DefaultBackend
2+ import SwiftCrossUI
3+
4+ #if canImport(SwiftBundlerRuntime)
5+ import SwiftBundlerRuntime
6+ #endif
7+
8+ @main
9+ @HotReloadable
10+ struct SimpleGridApp : App {
11+ let rowColors : [ Color ] = [ Color . red, Color . green, Color . blue]
12+ let columnColors : [ Color ] = [ Color . yellow, Color . orange, Color . purple]
13+ var body : some Scene {
14+ WindowGroup ( " SimpleGridExample " ) {
15+ Grid ( horizontalSpacing: 30 , verticalSpacing: 30 ) {
16+ ForEach ( 0 ..< rowColors. count) { row in
17+ GridRow {
18+ ForEach ( 0 ..< columnColors. count) { column in
19+ Text ( " (Column: \( column) , Row: \( row) ) " )
20+ . font ( . system( size: 24 ) )
21+ . background ( rowColors [ column] )
22+ }
23+ }
24+ . foregroundColor ( columnColors [ row] )
25+ }
26+ }
27+ }
28+ . defaultSize ( width: 800 , height: 500 )
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments