WKWebView ⚡️vs. UIWebView – Pros 👍 & Cons 👎

  • iOS
  • December 13, 2019
  • Home
  • iOS
  • WKWebView ⚡️vs. UIWebView – Pros 👍 & Cons 👎

A debate has been going around in the past years over which app is better and which is not? After looking at the following differences and pros and cons, you will be able to differentiate which one is better. Since Apple bans UIWebView apps in the future, a strong point for WKWebView apps is made.

WKWebView Apps:

WKWebView is the current WebKit API’s centerpiece introduced in macOS Yosemite and iOS 8. You can utilize the WKWebView class to fix web data in your app. For making a WebView object, you have to place it as a view then send a request to load the web content.

Pros:

  • WKWebView apps tend to run out of a process, which means its memory is connected individually from the app. When it surpasses its allocation, it crashes without the crash of the app, and that results in attempts to reload the page, and the app is notified.
  • Nitro JavaScript engine is used by WKWebView and has shown significant results in the performance over the JavaScript engine of UIWebView.
  • The communication between native code and JavaScript is taken care of asynchronously in WKWebView, meaning general executions are performed quickly.
  • Many touch delays are also eliminated. Experiments have proven that the delay only occurs when a fast tap ( <~ 125 ms), and this is more likely to be a double-click gesture used for ‘tap-to-zoom’ and not a slow tap (>~ 125).
  • Apple is still accepting apps based on WKWebView
  • The powerful WebViewGold app template uses this engine, too

Cons:

  • The WKWebView is only accessible for devices that run on iOS 9. When WKWebView was established on iOS 8, it had various limitations that included unable to access files that are locally stored.
  • No XHR requests are allowed to file:// URLs because these infringe the resource sharing rules of the browser’s engine. To access such requests, one needs to use the UIWebView browsing engine that exists, or it has to be hosted fairly on a server.
  • ‘Only Notify Browser’ and ‘Cache Source’ are not applicable while using the WKWebView engine.

 

UIWebView Apps:

UIWebView is an iOS application that allows the app developers to set web content within their native apps by simply implanting the web-based app in a native container. This approach makes the development of apps controversial and interesting. However, some specific pros and cons that include cross-platform compatibility.

Pros:

The primary profit of powering a native app with UIWebView is that it is the classical, old-fashioned enginge by iOS and you will not have any surprises. For example, native dialogs (like prompt(), …) on JavaScript will work by default but the would need some tweaks in WKWebView.

 

Cons:

The app itself is not written in the latest rendering code, which means it cannot take complete advantage of the device used. The results can be hindered as apps cannot take complete advantage of the power of the device. Since iOS 4, the apps based on UIWebView that were instigated did not benefit from the JavaScript performance as they did while running in the Safari app. The biggest contra point is that Apple will stop accepting apps based on UIWebView in 2020 (consider upgrading to WebViewGold app template)