This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var columns: [GridItem] = [ | |
GridItem(.flexible()), | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var columns: [GridItem] = [ | |
GridItem(.fixed(200)), | |
GridItem(.fixed(200)), | |
GridItem(.fixed(200)) | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var columns: [GridItem] = [ | |
GridItem(.fixed(200)), | |
GridItem(.fixed(100)), | |
GridItem(.fixed(100)) | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NavigationView { | |
ScrollView { | |
LazyVGrid(columns: columns) { | |
ForEach(1..<20) { _ in | |
Rectangle() | |
.fill(Color.red) | |
.aspectRatio(contentMode: .fit) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NavigationView { | |
LazyVGrid(columns: columns) { | |
Rectangle() | |
.fill(Color.red) | |
.aspectRatio(contentMode: .fit) | |
Rectangle() | |
.fill(Color.red) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var columns: [GridItem] = [ | |
GridItem(.fixed(100)), | |
GridItem(.fixed(100)), | |
GridItem(.fixed(100)) | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct CounterView: View { | |
@StateObject var counter = Counter() | |
var body: some View { | |
VStack { | |
Text("\(counter.value)") | |
Button("Increment Counter") { | |
counter.value += 1 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
@State private var count: Int = 0 | |
var body: some View { | |
VStack { | |
Text("\(count)") | |
Button("INCREMENT") { | |
count += 1 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
var body: some View { | |
VStack { | |
CounterView() | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct CounterView: View { | |
@ObservedObject var counter = Counter() | |
var body: some View { | |
VStack { | |
Text("\(counter.value)") | |
Button("Increment Counter") { | |
counter.value = counter.value + 1 | |
} |