The new WebView implementation in *OS 26 versions is a very valuable addition to the SwiftUI toolset. I was experimenting with it and was wondering how to implement a Pull To Refresh. While this was easily achievable with the "old" WKWebView I was not able to find an API to implement, for example, a page reload when the user uses a pull to refresh gesture.
I tried to attach to a .refreshable(_:)
modifier to the WebView but without success.
Is there an official API for that or should maybe .refreshable(_:)
already work and it's just a bug or is it simply not yet supported?
Here is a minimal example I was trying but didn't succeed:
struct ContentView: View {
@State private var page = WebPage()
var body: some View {
NavigationStack {
WebView(page)
.refreshable {
page.reload()
}
}
}
}
Any help is much appreciated. Thank you!