When I use a List view I can easily add the refreshable
modifier to trigger refresh logic. My question is how to achieve the same when using a LazyVStack instead.
I have the following code:
struct TestListView: View {
var body: some View {
Text("the list view")
// WORKS:
// VStack {
// List {
// ForEach(0..<10) { n in
// Text("N = \(n)")
// }
// }
// .refreshable {
//
// }
// }
// DOES NOT SHOW REFRESH CONTROL:
ScrollView {
LazyVStack {
ForEach(0..<10) { n in
Text("N = \(n)")
}
}
}
.refreshable {
}
}
}
How can I get the pull to refresh behavior in the LazyVStack
case?