Hello, I'm trying to show the loading indicator while my page is being read, but it did not work. I searched the internet, but I do not have the complete code and I'm a beginner in Swift. Can you help?
import UIKit
import WebKit
class ViewController: UIViewController, WKNavigationDelegate {
@IBOutlet weak var indicador1: UIActivityIndicatorView!
@IBOutlet weak var webview: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
loadadress()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func loadadress(){
let url: URL = URL(string: "http://www.google.com.br")!
let urlRequest: URLRequest = URLRequest(url: url)
webview.scrollView.isScrollEnabled = false;
webview.scrollView.bounces = false;
webview.load(urlRequest)
}
func webViewDidStartLoad(_: UIWebView){
indicador1.startAnimating()
}
func webViewdDidFinishLoad(_:UIWebView){
indicador1.stopAnimating()
}
}