0

The bug is “row”

Let boardersize = CGFloat(5) VStack(spacing:boardersize) { For each(0…2, id(): \.self) } row; in HStack(spacing:boarder size) { For each(0…2, id(): \.self) {

27th Dec 2022, 7:40 PM
Emmanuel Pena
4 odpowiedzi
+ 5
Looks like you are trying to create a board game with a 3x3 grid of cells. Without more context or information about the error you are experiencing, it is difficult to provide a specific solution. you can however modify the row in the code you posted like this. let boarderSize = CGFloat(5) VStack(spacing:boarderSize) { ForEach(0...2, id: \.self) { row in HStack(spacing:boarderSize) { ForEach(0...2, id: \.self) { column in // create a cell here } } } }
28th Dec 2022, 8:48 AM
Sadaam Linux
Sadaam Linux - avatar
+ 5
To create a cell , you can use the List view and provide it with a data source and a closure that returns a view for each element in the data source. Here's an example of how you might create a simple cell in a list: struct MyCell: View { let title: String var body: some View { Text(title) } } struct MyList: View { let data: [String] var body: some View { List(data, id: \.self) { title in MyCell(title: title) } } }
28th Dec 2022, 1:37 PM
Sadaam Linux
Sadaam Linux - avatar
0
How do i create the cell
28th Dec 2022, 12:35 PM
Emmanuel Pena
0
Example please
28th Dec 2022, 12:36 PM
Emmanuel Pena