In the following sample code, if remove the underscore in the webViewDidFinishLoad
declaration, it doesn't fire. What does the underscore do?
import UIKit
class ViewController: UIViewController, UIWebViewDelegate {
@IBOutlet weak var playerWebView: UIWebView!
let youtubeUrl = URL(string: "https://youtube.com")
override func viewDidLoad() {
super.viewDidLoad()
playerWebView.delegate = self
let request = URLRequest(url: youtubeUrl!)
playerWebView.loadRequest(request)
print("viewDidLoad")
}
func webViewDidFinishLoad(_ playerWebView: UIWebView) {
print("webviewFinishedLoad")
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}