Simon Walachowski Simon Walachowski - 1 month ago 18
Swift Question

Adding address to web view

I try to add address in several ways, but it's not working all the time. Anybody know the right code?

import UIKit

class ViewController: UIViewController {
@IBOutlet weak var Dziennik: UIWebView!

override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.

webView.loadRequest(NSURLRequest(URL: NSURL(string: "http://www.google.com")!))
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}

Answer
let url = URL (string: "http://google.com")       

let requestObj = URLRequest(URL: url!); Dziennik.loadRequest(requestObj)

Comments