WebView Tutorial in iOS 8 With Swift
The UIWebView class is use to embed web content in an application. It can be done by simply creating a UIWebView object and attaching it to ...

Open Xcode and create a new Single View Application. Fill out the Product Name, Organization Name and Organization Identifier with your customary values. Enter Swift as Language and make sure only iPhone is selected in Devices.
Go to the Storyboard and On the bottom of the Interface Builder you’ll see something that says “w Any”, “h Any”. Change the width to compact and height to regular to change the view to an iPhone in portrait mode.
Add a Web View to the main view. The ViewController should look like this.
override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. let requestURL = NSURL(string:url) let request = NSURLRequest(URL: requestURL) webView.loadRequest(request) }
And that's it. Build and Run the project and wait for a couples of second and you should be able to view the website displayed into the web view.
Post a Comment