I'm trying to achieve the following grid layout with SwiftUI but not quite sure on the best approach.
My code is below and it's not quite getting what I want and also seems hacky to have many nested stacks
VStack {
VStack {
HStack {
VStack {
Text("Text Here")
Text("336.851")
}
.padding(20)
.background(ColorManager.orange)
.cornerRadius(10)
VStack {
Text("Text Here")
Text("336.851")
}
.padding(20)
.background(ColorManager.red)
.cornerRadius(10)
}
HStack {
VStack {
Text("Text Here")
Text("336.851")
}
.padding(20)
.background(ColorManager.green)
.cornerRadius(10)
VStack {
Text("Text Here")
Text("336.851")
}
.padding(20)
.background(ColorManager.blue)
.cornerRadius(10)
VStack {
Text("Text Here")
Text("336.851")
}
.padding(20)
.background(ColorManager.purpleLight)
.cornerRadius(10)
}
}
}
My code gives the below result, I'm just not sure how I would max the boxes span half and a third of the screen. Also, is the approach I've taken with nested stack the right way?