import UIKit
classViewController:UIViewController {
@IBOutlet weak var webview:UIWebView!
@IBOutlet weak var searchBar: UIBarButtonItem!
@IBOutlet weak var Stop: UIBarButtonItem!
@IBOutlet weak var Reload: UIBarButtonItem!
@IBOutlet weak var Back: UIBarButtonItem!
// Page to open at startup
let homeUrlString="https://www.google.co.jp/"
override func viewDidLoad(){
super.viewDidLoad()
// open a website
open(urlString:homeUrlString)
}
// Open the specified url in web view
funcopen(urlString:String){
let url = URL (string: urlString)
let urlRequest=URLRequest(url:url!)
WebView.loadRequest (urlRequest)
}
@ IBAction func BackButtonTapped (sender: UIBarButtonItem) {
}
@ IBAction func reloadButtonTapped (sender: UIBarButtonItem) {
}
@ IBAction func stopButtonTapped (sender: UIBarButtonItem) {
}
}
WebView.loadRequest(urlRequest)
shows use of unresolved identifier
and I don't know what's wrong.I'm a beginner and I'm following the reference book, and it looks like this...
Someone please tell me what's wrong.
The language is Swift
The W
and V
in WebView
in WebView.loadRequest(urlRequest)
are capitalized.
@IBOutletweakvar webview:UIWebView!
defines all lowercase letters as webview
and must be written the same way.Swift is case sensitive and interprets it as a different variable.
Therefore, the error unresolved identifier
is trying to use an undefined property.
578 PHP ssh2_scp_send fails to send files as intended
601 GDB gets version error when attempting to debug with the Presense SDK (IDE)
568 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
898 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.