I don't know about you guys, but when I opened up my project today (the first time since Swift switched to running iOS 15 as the default) my UI looked shockingly different. Most importantly, previously adjacent views inside a ForEach now have some padding in between.
How can we eliminate this? I've included some sample code but I hope we can find a solution that can generalize. The actual problem in my UI has too many moving parts to include here.
struct IntItem: Identifiable {
let num: Int
let id = UUID()
}
struct ItemView: View {
var item: IntItem
var body: some View {
Text(String(item.num))
.padding(10)
.border(Color.black)
}
}
struct ContentView: View {
let array: [IntItem]
var body: some View {
ScrollView {
ScrollViewReader { thing in
ForEach(array) { item in
ItemView(item: item)
}
}
}
}
}
let content = ContentView(array: [IntItem(num: 0), IntItem(num: 1), IntItem(num: 2), IntItem(num: 3)])