Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Major Feature Difference Between UIWebView and WKWebView

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 8.08k
    Comment on it
    • Because of the need of showing the HTML data/content inside an application the WKWebView is developed. It was introduced by iOS 8.0 whereas UIWebView was introduced by iOS 2.0

     

     

    • The UIWebView is a part of UIKit and available in the applications so no need to import anything only drag and drop of UIWebView will work for the design where as WKWebView run as a separate process so need to import to the application.

     

    • The UIWebView uses UIKit framework whereas WKWebView uses WebKit.framework.

     

    • Scale pages to fit - this feature is available in UIWebView but not available in WKWebView.

     

    • The WKWebView has higher and efficient performance as compared to the UIWebView and available to the developers till iOS 8.

     

    • The WKWebView have some extra support than UIWebView like IndexedDB and ObjectStore ArrayBuffer.

       

      • IndexedDB is a database which is used to manage the data with the help of the index. Indexing helps in identifying data easily with the help of index and the particular one from the stored data. It is like SQL database and object-oriented database. Objects can be stored and retrieve with a key. 
      •  

      • The ArrayBuffer is a collection of objects used to represent particular fixed length binary data. The content of ArrayBuffer can not be manipulated directly from the array. Data inside the objects can only be read and write from the buffer which represents a specific format.

     

    • The WKWebView renders about 8500 objects whereas UIWebView renders about 3500 objects and performance of WKWebView is twice good as compared to UIWebView.

     

    • The percentage of usage of CPU tells the actual performance so WKWebView uses 25% CPU to render the same number of particles whereas UIWebView uses 90% CPU for the same task.

     

    • The WKWebView is not able to load local files but this feature is available in UIWebView.

     

    • The UIWebView load only one time and data get saved in cookies so that next time loading time will be less as compared to previous time whereas in WKWebView no cookies will get saved so always loading time will be same.

     

     

    Code to load web page with the help of UIWebView

     

    import UIKit
    
    class UIWebViewController: UIViewController{
       @IBOutlet weak var webView: UIWebView!
    
        override func viewDidLoad() {
            super.viewDidLoad()
                let url = URL (string: "https://www.google.co.in/maps")
                let requestObj = URLRequest(url: url!)
            webView.backgroundColor = UIColor.blue
                webView.loadRequest(requestObj)
            
            // Do any additional setup after loading the view.
        }
    
        override func didReceiveMemoryWarning() {
            super.didReceiveMemoryWarning()
            // Dispose of any resources that can be recreated.
        }
    
    }

     

     

    Code to load web page with the help of WKWebView

    import UIKit
    import WebKit
    
    class WKWebViewController: UIViewController, WKNavigationDelegate {
        var webView : WKWebView!
        override func viewDidLoad() {
            super.viewDidLoad()
            let myBlog = "https://iosdevcenters.blogspot.com/"
            let url = NSURL(string: myBlog)
            let request = NSURLRequest(url: url! as URL)
            
            // init and load request in webview.
            webView = WKWebView(frame: self.view.frame)
            webView.navigationDelegate = self
            webView.load(request as URLRequest)
            self.view.addSubview(webView)
            self.view.sendSubview(toBack: webView)
            // Do any additional setup after loading the view.
        }
    
        override func didReceiveMemoryWarning() {
            super.didReceiveMemoryWarning()
            // Dispose of any resources that can be recreated.
        }
        
    
    }

     

    Major Feature Difference Between UIWebView and WKWebView

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: