Thursday, August 13, 2015

WKWebView for Hybrid Apps in iOS 8

With the release of iOS 8, Apple has brought so many changes in the Framework existing classes and have introduced new classes.

For Hybrid App development we introduced UIWebView, Which is used for displaying the Web content. 

However, with the release of iOS Apple has introduced a new class called WKWebView. which is derived from UIView here is the inheritance chain for WKWebView.

NSObject
|
UIResponder
|
UIView
|
WKWebView

WKWebView is also derived from UIView similar to UIWebView, So what are the difference in both.


Performance



Performance of WKWebView is one thing that makes it mandatory to use. If you are still using UIWebView for your App or Game for iOS than you should right away move to WKWebView.


We are talking about performance in the first place because the performance of the Hybrid App is one thing that we all think of before starting implementation or deciding whether to use a Hybrid App path or not. WKWebView has definitely improved the performance. I think an average Hybrid app can detect about 20% increase in Performance. 

It uses the same javascript engine that empowers Safari, also the popup browsers embedded in the apps like Twitter and Facebook.

Other differences are 

  • UIWebView belongs to UIKit.Framework. However, WKWebView belongs to WebKit.Framework.
  • WkWebView support IndexedDB.
  • HTML 5 support score for WKWebview is 440/500 in iOS 8, which is 427/500 for UIWebView.
  • WebGL is now supported. This is huge for game developers who need native level animations for 3D gaming.
  • Javascript is almost 4x times faster with WKWebView.



Usage of WKWebView in Hybrid App


As we talk about Hybrid about so I would not discuss how we can use WKWebView in Native apps but we will discuss how to use the WKWebView in Hybrid App.

  • If you are using Telerik platform for app development than you can use Telerik plugin for your app to start using WKWebView for your app rendering in iOS. you can find the details about here at Telerik plugin for WKWebView 


The question must come to our mind that does WKWebView is going to replace UIWebvew?


I think Yes, as Apple have done so many memory and performance related improvements in wkwebview and though it is still getting stable. I think UIWebView will be here for some time. But WKWebView should be used if you are using ios 8 or later.  As of now, more than 90% of devices use iOS 7 or higher and whenever Apple updates the OS it is observed that most of the times this percentage remains the same. So, it is wise to stick to the latest when we know that it would be used by many. 
Also, Hybrid App frameworks are getting matured and recognized by Apple and are that's why I think Apple is making these changes as number of Hybrid Apps are increasing day by day. 


you can follow twitter handler for WKWebView for updates.

Happy coding!!

No comments:

Post a Comment