diwu / DWUWebView

A WKWebView wrapper that serves as a drop-in replacement for the legacy UIWebView.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#DWUWebView

A WKWebView wrapper that serves as a drop-in replacement for the legacy UIWebView.

#Why WKWebView?

Facebook migrated from UIWebView to WKWebView and reported a significant reduction of OOMs due to the fact that WKWebView now renders web pages in separate processes out of the app.

Besides, WKWebView is so much faster than UIWebView that your web development co-workers might burst into tears.

#Installation

Step 1: Drag DWUWebView.h and DWUWebView.m into your project.

Step 2: There's no step 2.

Or, if you are using CocoaPods, add the following requirement into your Podfile:

pod 'DWUWebView'

#Accurate Loading Progress

If you are using that popular JavaScript trick to simulate the web page loading progress, DWUWebView will likely break it (see Known Issues below). However, thanks to the new APIs brought by WKWebView, you can now have much more accurate loading progress callbacks.

See DWUWebViewProgressDelegate in DWUWebView.h for more details. It's a delegation style API and is really easy to use.

#Known Issues

Due to WKWebView's implementation details, you can find a list of unsupported APIs in DWUWebView.h.

Besides, due to an architectural change that forces WKWebView to process JavaScript injection on an asynchronous basis. The stringByEvaluatingJavaScriptFromString: API will always return a garbage value. So do not use its return value.

About

A WKWebView wrapper that serves as a drop-in replacement for the legacy UIWebView.

License:MIT License


Languages

Language:Objective-C 100.0%