Skip to content

Commit

Permalink
Fix build issue only happening in Xcode 16.0.0 specifically
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Oct 30, 2024
1 parent 615aa53 commit c4e55e0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/HandySwiftUI/Types/Views/WebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down

0 comments on commit c4e55e0

Please sign in to comment.