Home   →   Blog   →   Beginner's Guide: Modern Apple WebKit Framework

    Beginner's Guide: Modern Apple WebKit Framework

    The newest release of the WebKit framework in iOS8 provided significant simplification of iOS development process. 

    The previous version of iOS allowed to useUIWebViews based on UIKit framework. The biggest disadvantage of this implementation related to In-Process loading of web content. Plus UIWebViews didn't contain Javascript Nitro engine optimization, that vastly improved speed of interpreting scripts and led to compilation of JavaScript code into native machine code. One more additional disadvantage of UIWEbView was that many web kit capabilities were not shared with developers. So believe me, Javascript bridging looked like a pain. However, new WebKit framework contains a list of the new features like smooth scrolling, gestures, key-value observing of new WKWebView’s properties, native communication.

    The first of them was achieved by exploiting Core Animation and hardware acceleration providing 60 fps. As for gestures, now WKWebViews supports track-pad gestures such as swipe to go back and pinch to zoom. Go further, to check exact status of the web view at any given time such properties of WKWebView as progress, title, URL can be observed by KVO. Native JS Bridging becomes possible with the help of new APIs: UserScripts and ScriptMessages. The first allows developer to inject JavaScript code into a webpage and run it on a specific part of a page. The second one enables the native code to receive callbacks (like NSNotification) from the User Scripts injected into the page.

    The crucial achievement of WebKit is that every single web content of WKWebView runs in its own process completely isolated from our app. And its processes are handled by the system. It improves responsiveness of App when web pages load a lot of JS objects and run a lot of scripts. It gives an opportunity to put individual web pages for things like background tabs and fully-occluded Windows.

    And finally new WKNavigationAction class offers protocol methods which is called multiple times by the loading of a web page. Property navigationType determines the type of action triggering the navigation. We can track the loading process and tweak it according to the needs of Application.

    Summary: Modern WebKit framework provides developers with the opportunity to build powerful, modern and responsive apps using web contents.

    If you have any specific questions on possible implementation of these features in your product feel free to contact us by this Contact form.

    Next Posts
    Android Widgets
    Android widgets are small applications that can be...
    The New Apple TV
    With the release of the new Apple TV running on tvOS...