We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 615aa53 commit c4e55e0Copy full SHA for c4e55e0
Sources/HandySwiftUI/Types/Views/WebView.swift
@@ -74,9 +74,10 @@ public struct WebView: View {
74
75
func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
76
if let scrollOffsetOnPageLoad = parent.scrollOffsetOnPageLoad {
77
- delay(by: .milliseconds(250)) {
+ Task {
78
+ try await Task.sleep(for: .milliseconds(250))
79
let scrollScript = "window.scrollBy({ top: \(scrollOffsetOnPageLoad.y), left: \(scrollOffsetOnPageLoad.x), behavior: 'smooth' });"
- webView.evaluateJavaScript(scrollScript, completionHandler: nil)
80
+ try await webView.evaluateJavaScript(scrollScript)
81
}
82
83
0 commit comments