Skip to content

Instantly share code, notes, and snippets.

@arpit
Created January 12, 2026 03:58
Show Gist options
  • Select an option

  • Save arpit/31aad30d67cccc50663c8605616b7340 to your computer and use it in GitHub Desktop.

Select an option

Save arpit/31aad30d67cccc50663c8605616b7340 to your computer and use it in GitHub Desktop.
Offsets the content of a webview
func makeUIView(context: Context) -> WKWebView {
let webView = WKWebView()
webView.navigationDelegate = context.coordinator
webView.scrollView.contentInset = UIEdgeInsets(top: ArticleWebView.webviewContentOffset, left: 0, bottom: 0, right: 0)
webView.scrollView.verticalScrollIndicatorInsets = UIEdgeInsets(top: ArticleWebView.webviewContentOffset, left: 0, bottom: 0, right: 0)
return webView
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment