Button gives an error message, i dont know how to fix it. Can somebody please help? This is the error: Use of local variable 'buttonAction' before its declaration
//button
let buttonFrame = CGRect(x: 50, y: 50, width: 50, height: 40)
let button = UIButton(frame: buttonFrame)
button.backgroundColor = UIColor.black
webView.scrollView.addSubview(button)
button.addTarget(self, action: #selector(buttonAction), for: .touchUpInside)⚠
func buttonAction(sender: UIButton!) {
if webView.url != nil {
webView.reload()
} else {
webView.load(URLRequest(url:url)) //where originalURL is the URL you're initially using to show in webView
}