GIF Reproducing the error
Can someone please enlighten me why is the view stuttering whenever i pull down to refresh ? This behaviour happens when .refreshable() and .searchable() are in the same view. If i remove .searchable(), the refresh animation behaves normal. This problem is haunting me in every project and this is a simple SwiftUI code, what i’m doing wrong ? what is the issue here?
import SwiftUI
struct TestView: View {
@State private var text: String = ""
let listings: [String] = ["Hello world", "Hello StackOverflow"]
var body: some View {
NavigationStack {
Group {
VStack {
List {
ForEach(listings, id: .self) { item in
Text(item)
}
}
.refreshable {}
.navigationTitle("Listings")
}
}
}
.searchable(text: $text)
.task {}
}
}
#Preview {
TestView()
}