Open denis-obukhov opened 2 years ago
The library uses branching for active
and not active
states. So first of all, you need to explicitly pass in the active
argument:
.shimmering(active: shouldShim)
Also, you are using branching too! So the code will not call the false
state if you just put it in the way you write it!
So you need to extract the shimmer out like:
func listView(shouldShim: Bool) -> some View {
var listView: some View {
if shouldShim {
return skeletonView
} else {
return listView // <- What is this by the way ? do you mean self.listView ? 🤔
}
}
return listView
.shimmering(active: shouldShim)
}
This is just a work around and I hope the library supports the branching and auto animation stop for reduce the CPU usage
Hi. If I have a view like this:
Then even if isLoading is false is still consumes CPU. The more cells the more consumption. I have about 36% on my iPhone 11 even if there's no shimmering view on screen. If remove shimmering then CPU load is 0%.