Add UIScrollViewDelegate delegate
class ViewController: UIViewController, UIScrollViewDelegate {
}
add proxy=SELF to WebView
webView.scrollView.delegate = self
Then just like other WEBVIEW listeners, for example: Triggered whenever there is scrolling,
func scrollViewDidScroll(_ scrollView: UIScrollView) { print("do scroll") //Print the real-time position of the current scroll bar print(scrollView.contentOffset.y) }
** Manually set the webView scroll bar position
webView.scrollView.contentOffset.y -= 10