Post

Replies

Boosts

Views

Activity

Reply to SwiftUI Scrollview disable clipping
Hey guys, I've found a decent solution for this problem. BEFORE: AFTER: I've added 2 paddings to ScrollView and to content of ScrollView with the same amount of padding but one with NEGATIVE value like this: struct ScrollViewClippingProblem: View { var body: some View { VStack { Text("Lorem Ipsum") .font(.title) ScrollView(.horizontal, showsIndicators: false) { HStack(alignment: .top) { ForEach(0..<10, content: { item in Text("\(item)") .font(.title) .padding() .background(Circle().fill(.red)) .shadow(color: .blue, radius: 10, x: 15, y: 10) }) } .padding(.vertical, 40) // <- add padding here to make the space for the shadow } .padding(.vertical, -40) // <- add NEGATIVE padding here of the same value to shrink the space you created with the padding above Text("Lorem Ipsum") .font(.title) } .background(.ultraThinMaterial) } } I hope this helps! :)
Sep ’22