I have been facing poor scrolling performance when using UIVisualEffectViews in a long List on SwiftUI.
Here is my implementation of the UIVisualEffectView:
And here is the implementation of the List:
Any ideas on how to troubleshoot this?
Here is my implementation of the UIVisualEffectView:
Code Block swift struct BlurView: UIViewRepresentable { var style: UIBlurEffect.Style func makeUIView(context: Context) -> UIVisualEffectView { return UIVisualEffectView(effect: UIBlurEffect(style: style)) } func updateUIView(_ uiView: UIVisualEffectView, context: Context) { uiView.effect = UIBlurEffect(style: style) } } extension View { func blurEffect(style: UIBlurEffect.Style) -> some View { background(BlurView(style: style)) } }
And here is the implementation of the List:
Code Block swift struct ListView: View { var body: some View { NavigationView { List { Section(footer: Spacer()) { ForEach(People.allCases, id: \.rawValue) { person in HStack { Text(person.name) .font(.headline) .multilineTextAlignment(.leading) .padding(13) .frame(minHeight: 50) .background( BlurView(style: .prominent) .mask(RoundedRectangle(cornerRadius: 15, style: .continuous))) .fixedSize(horizontal: false, vertical: true) Spacer() Text(person.age) .font(.headline) .multilineTextAlignment(.leading) .padding(13) .frame(minHeight: 50) .background( BlurView(style: .prominent) .mask(RoundedRectangle(cornerRadius: 15, style: .continuous))) .fixedSize(horizontal: false, vertical: true) } } } }.id(UUID()) } } }
Any ideas on how to troubleshoot this?