Implementing UIWebView in iOS Application

In this tutorial ho easy it is to convert any website into a nice iOS app just following some simple steps. So, lets get started. Open your Xcode, select single view application and create your project. After that you need to drag a UIWebview from objects library and add the necessary constraints to it.

 

a

 

 

Next, go to Info.plist file and add App Transport Security Settings and select allow arbitrary loads to yes in the list as shown below. This step is necessary to perform if you want to load your custom websites instead of just adding  google or yahoo etc.

b

Now create a connection of your webview with the viewcontroller.swift through assistant editor and add the following code.

 

ViewController.swift

 

 

AppDelegate.swift

 

 

 

c

 

Now, when you will run your app you will achieve this but until now you wont have any option to refresh, go backward or forward etc. So, we will add these options through dragging a toolbar from the the objects library and adding buttons to it.

 

d

And finally you need to make the connections of these buttons with the viewcontroller. Here comes the effiecient power of Xcode and UIWebview, you can just drag any button to selected webview and it automatically provides you in built features to go back or forward or to refresh etc. Select them and enjoy your GoogleApp.

 

e

 

 

Download: GoogleApp

Shares

Leave a Reply

Your email address will not be published. Required fields are marked *