I am using a web view in my app, but when it is loading, it is all white. This looks as if thi spart of my app is broken, so I wanted to add an activity indicator. Note - I am using the depreciated web view. I tried the following code
import UIKit
class MeetingsViewController: UIViewController {
@IBOutlet weak var webView: UIWebView!
@IBOutlet weak var activity: UIActivityIndicatorView!
override func viewDidLoad() {
super.viewDidLoad()
let Rwebsite = URL(string: {"https://www.google.com")
// loading my web view
// (No errors with this
webView.loadrequest(URLRequest(url: Rwebsite!))
}
// now i am trying to make the activity indicator start animating when the view is loading, and stop animating when the view stops loading
func webViewDidStartLoad(_ : UIWebView){
activity.stopAnimating()
}
func webViewDidFinishLoad(_ : UIWebView){
activity.stopAnimating()
}
Also, I control dragged my web view to my view controller and selected delegate.
I selected that my activity indicator dissapears when done
Now for my issue -
When I run my app, the web view finishes loading, and my activity indicator doesn't disspaear, and it continues animating on top of my webView
Does anybody know how to fix this - Any help is appreciated!