I have this List:
struct SignInList: View {
@ObservedObject var model:SignInModel
var body: some View {
List(model.currentSignIns) { signIn in
SignInRow(description: signIn)
}
}
}
With this list row:
struct SignInRow: View, Identifiable {
let id = UUID()
let description: SignInDescription
var body: some View {
VStack {
ButtonView(view: description.button)
}
}
}
// Map a UIView to a View. Will be using this to hold a UIView based sign-in button
// https://developer.apple.com/tutorials/swiftui/creating-and-combining-views
struct ButtonView: UIViewRepresentable {
let view: UIView
func makeUIView(context: Context) -> UIView {
return view
}
func updateUIView(_ uiView: UIView, context: Context) {
}
}
but when I scroll the list, the cells of the list disappear:
If I change the list cells to purely SwiftUI, e.g.,
struct SignInRow: View, Identifiable {
let id = UUID()
let description: SignInDescription
var body: some View {
VStack {
Rectangle()
}
}
}
I do not get this effect. The cells do not disappear when scrolling.
I have tried some ideas on SO (e.g., SwiftUI and ScrollView: Views Disappear After Device Rotation and Content in scrollview as a list item disappears when scrolling (swiftui), why?) but no real improvement so far. (When I embed a ForEach in a ScrollView, I get different problems-- only one of my two rows shows up and the buttons are no longer tappable).
