I have a body with a VStack, another VStack inside that I'd like to start 20 points in, just like my "Explore More" text but for some reason it's indented like this and I can't figure out why. Would love some help here.
struct BrandExploreMore: View {
let brand: Brand
var body: some View {
VStack {
HStack {
Text("Explore More")
.font(.headline)
.foregroundColor(BrandColors.titleGray.color)
.padding(.leading, 20)
Spacer()
}
VStack(spacing: 12) {
Grid(leftTitle: "Desert", rightTitle: "Kids")
Grid(leftTitle: "Stripes", rightTitle: "Pastels")
}
//.padding(.horizontal, 20)
// .padding(EdgeInsets(top: 0, leading: -40, bottom: 0, trailing: 0))
.padding(.bottom, 20)
.background(SwiftUI.Color.red)
}.background(SwiftUI.Color.orange) // end VStack
}
}
struct BrandExploreMore_Previews: PreviewProvider {
static var previews: some View {
BrandExploreMore(brand: .kateZaremba)
}
}
// MARK: - Grid
struct Grid: View {
let leftTitle: String
let rightTitle: String
@State private var showLeft = false
@State private var showRight = false
var body: some View {
HStack(spacing: 12) {
// Spacer()
Button(action: { self.showLeft = true }) {
ZStack {
Image(leftTitle)
Text(leftTitle)
.foregroundColor(BrandColors.titleGray.color)
.font(.subheadline)
}
}.sheet(isPresented: self.$showLeft) {
Text(self.leftTitle)
}
Button(action: { self.showRight = true }) {
ZStack {
Image(rightTitle)
Text(rightTitle)
.foregroundColor(BrandColors.titleGray.color)
.font(.subheadline)
}
}.sheet(isPresented: self.$showRight) {
Text(self.rightTitle)
}
// Spacer()
}
}
}
GridView
as that may be affecting padding that you have in the secondVStack
? Have you tried taking the padding off of the secondVStack
? – Andrew