From c4e55e03211300f62bd1926e9404470d31cc0562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Wed, 30 Oct 2024 13:53:15 +0100 Subject: [PATCH] Fix build issue only happening in Xcode 16.0.0 specifically --- Sources/HandySwiftUI/Types/Views/WebView.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/HandySwiftUI/Types/Views/WebView.swift b/Sources/HandySwiftUI/Types/Views/WebView.swift index 63e6036..f2d4f93 100644 --- a/Sources/HandySwiftUI/Types/Views/WebView.swift +++ b/Sources/HandySwiftUI/Types/Views/WebView.swift @@ -74,9 +74,10 @@ public struct WebView: View { func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) { if let scrollOffsetOnPageLoad = parent.scrollOffsetOnPageLoad { - delay(by: .milliseconds(250)) { + Task { + try await Task.sleep(for: .milliseconds(250)) let scrollScript = "window.scrollBy({ top: \(scrollOffsetOnPageLoad.y), left: \(scrollOffsetOnPageLoad.x), behavior: 'smooth' });" - webView.evaluateJavaScript(scrollScript, completionHandler: nil) + try await webView.evaluateJavaScript(scrollScript) } } }