In iOS 8, Apple introduced WKWebView which is more power and faster than the UIWebView.

Today We will learn how to create a Simple WKWebView  in iOS.


  1.  Create a project lets say (WKWebViewDemo).
  2. Now go to the storyBoard and drag a toolbar in ViewController and then take three Bar Button item.  Make Action for the buttons. Your storyboard will look something like this.

Screen Shot 2016-08-05 at 10.52.48 PM.png

  1. Now go to Your ViewController.m and write the following Methods.

#import “ViewController.h”

#import <WebKit/WebKit.h>

@interface ViewController ()<WKNavigationDelegate,WKUIDelegate>

@property(strong,nonatomic) WKWebView *webView;

@property (strong, nonatomic) NSString *productURL;


@implementation ViewController

– (void)viewDidLoad {


    [super viewDidLoad];

    self.productURL = @”;;

    NSURL *url = [NSURL URLWithString:self.productURL];

    NSURLRequest *request = [NSURLRequest requestWithURL:url];

    _webView = [[WKWebView alloc]init] ;

    _webView.UIDelegate = self;

    _webView.navigationDelegate = self;

    [_webView loadRequest:request];

    _webView.frame = CGRectMake(self.view.frame.origin.x,85, self.view.frame.size.width, self.view.frame.size.height85);

    [self.view addSubview:_webView];



    // Do any additional setup after loading the view, typically from a nib.



– (void)didReceiveMemoryWarning {


    [super didReceiveMemoryWarning];


    // Dispose of any resources that can be recreated.



– (IBAction)backBarButton:(id)sender {

    [_webView goBack];



– (IBAction)reloadBarButton:(id)sender {

    [_webView reload];



– (IBAction)forwardBarButton:(id)sender {

    [_webView goForward];



4. Now run the code, But You will say that nothing has loaded in the WKWebView because we have not set the NSAppTransportSecurity setting in the plist. Go to your plist and add this.

Screen Shot 2016-08-05 at 10.59.27 PM.png

5. Now run the app. You will see the desired output.

Screen Shot 2016-08-05 at 11.01.24 PM.png

6. You can download the whole source code from here.

Do share Your reviews.

Enjoy Coding 🙂