[ad_1]
I am making an attempt so as to add pull to refresh on my wkwebview app. I am utilizing UIViewRepresentable for my webview, so I haven’t got the onViewLoad operate and examine controllers. Here is my code:
var wbWebViewEl: WKWebView = WKWebView()
struct SwiftUiWebView: UIViewRepresentable {
....
class refreshWebViewClass {
@objc func refreshWebView1(sender: UIRefreshControl) {
print("check debug :D")
wbWebViewEl.reload()
DispatchQueue.essential.async {
sender.endRefreshing()
}
}
func makeUIView(context: Context) -> WKWebView {
......
wbWebViewEl.scrollView.bounces = true
let refreshControl = UIRefreshControl()
refreshControl.addTarget(self, motion: #selector(refreshWebViewClass.refreshWebView1), for: UIControl.Occasion.valueChanged)
wbWebViewEl.scrollView.addSubview(refreshControl)
wbWebViewEl.scrollView.refreshControl = refreshControl
.....
}
.....
}
In the meanwhile, whenever you swipe down, it reveals the refresh loading spinner, however it does not cease spinning. Additionally the check print I put within the refreshWebView1 operate, does not present within the logcat. Does anybody know what I am getting improper right here? If you might want to see anymore code let me know 🙂
[ad_2]
