WebView Tutorial in iOS 8 With Swift
Tech-Today

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 a window and then sending it a request to load web content.

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.


 Select the assistant editor and open the ViewController.swift file. Ctrl and drag from the button to the class section and create the following outlet.



We will be needing a property to hold the url of the web view we want to show, so add a constant property. 

let url = "https://developer.apple.com/swift/"


Next, change the viewDidLoad to


    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.




- Simple To-do List Using Core Data In Swift
Note: The steps 1-9 are all simply about setting-up the controllers. The main "core data" begins the next step after. Here's the finish project from step-1 to step-9. 1.) First, for us to have a better view, we have to disable the size classes....

- Create A Simple Table View App In Xcode
Open Xcode and create a new Single View Application. For product name, use SimpleTableView and then fill out the Organization Name and Company Identifier with your customary values. Select iPhone for Devices. Drag a table view inside the view controller....

- Xcode: Create A Simple Alertview
Open Xcode and create a new Single View Application. For product name, use SimpleAlertView and then fill out the Organization Name and Company Identifier with your customary values. Select iPhone for Devices. Drag a button inside the view controller...

- How To Differentiate Between 3.5 And 4 Inch Iphone
Open Xcode and create a new Single View Application. For product name, use DifferentiateIphoneSize and then fill out the Organization Name and Company Identifier with your customary values. Select iPhone for Devices. For demonstration purposes, add a...

- Display Time Picker On Textfield Click In Xcode
Open Xcode and create a new Single View Application. For product name, use TextFieldTimePicker and then fill out the Organization Name and Company Identifier with your customary values. Select iPhone for Devices. For setting up the user interface, first,...



Tech-Today








.