How to load URL in UIWebView in Swift?

前端 未结 18 1453
南旧
南旧 2020-11-29 00:58

I have the following code:

UIWebView.loadRequest(NSURLRequest(URL: NSURL(string: \"google.ca\")))

I am getting the following error:

18条回答
  •  -上瘾入骨i
    2020-11-29 01:20

    For swift 4.2, 5+

    @IBOutlet weak var webView: UIWebView!
    
        override func viewDidLoad() {
           super.viewDidLoad()
               //Func Gose Here 
              let url = URL(string: link)
              let requestObj = URLRequest(url: url! as URL)
               webView.loadRequest(requestObj)
    
           }
    

提交回复
热议问题