我正在尝试构建一个自定义滚动视图,该视图可以接收我创建的不同单元格并在滚动视图中显示这些单元格。我无法弄清楚如何将通用 SwiftUI 视图传递到我的自定义滚动视图结构的构造函数中,是否可以这样做?有些像这样:
struct CustomScroll<Content: View>: View {
var genericCell: View
var body: some View {
VStack(spacing: 10) {
ForEach(0...7, id: \.self){ index in
VStack(spacing: 10){
cell
}
}
}
}
}