我在SwiftUI还是新手.我想知道如何使我的ScrollView像List一样更灵活.你可以看到列表中的项目,它甚至只有在项目出现在屏幕上时才会触发,所以它可以更好地提高我的应用程序性能,但我不喜欢列表的外观,我想用ScrollView作为替代.我可以复制这个功能吗?
struct Content: View {
let tempoList: [String] = ["Mark", "Bill", "John", "Jeff", "Andrew"]
var body: some View {
List(tempoList, id: \.self) { _ in
ForEach(tempoList, id: \.self) { name in
Text("\(name)")
.onAppear {
print(name)
}
}
}
}
}