Webview to show loading indicator for every click inside the webview swift

Solution:

In the ViewController you have to implement the webView delegate methods as like below to achieve the every click action loader in the webView.


    func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {
        activityindicator.startanimating()
}


     func webViewDidFinishLoad(_ webView: UIWebView) {
        activityindicator.stopanimating()

}


    func webView(_ webView: UIWebView, didFailLoadWithError error: Error) {
        activityindicator.stopanimating()

}

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift