我的代码很简单:
struct ListView: View {
var body: some View {
ScrollView(.vertical) {
VStack(alignment: .leading) {
ForEach(0...10, id: \.self) { _ in
CellView()
Spacer()
}
}
}
}
}
struct CellView: View {
var body: some View {
Text("Template Text Template Text Template Text Template Text ")
}
}
如果我发表评论Spacer() or CellView()
,效果很好
为什么会发生?