my app has a View
which is rendered many more times than needed when I import a large data set into the app. This causes hangs in my app. I know CellView
, below, is the view that is rendered too frequently from using Instruments, and I know that its ObservedObject
member Data
triggers this, based on the output of Self._printChanges()
. I suspect that the attributes of Data
that are changing are not necessary to render CellView
. How can I determine which attributes of Data
are changing, and how can I change CellView
to rerender only when relevant attributes of Data
change?
struct CellView: View {
@ObservedObject var data: Data
var body: some View {
let _ = Self._printChanges()
Group {
renderDataCellView(data: data)
}
}
}