2-3x faster than a UIWebView • Changes and fixes applied to Safari usually not ported into UIWebView • UIWebview is clunky, crashy, leaks memory • Scrolling blocks images loading • Different JavaScript engine than Safari (not Nitro)
Apple wanted to make hybrid apps less performant and force everybody to use their native platform Excluded due to security reasons. Running a Just-In- Time compiler requires marking pages in RAM as executable - iOS does not allow this out of security concerns (except in Safari) Cynical Answer Real Answer
• 60fps scrolling • Better communication between Swift and JS (we haven’t experimented with this yet) • Since we are sharing the JS engine with Safari, WKWebView should be better maintained and more reliable
ton of great documentation! • What was formerly a single class (UIWebView) and protocol (UIWebViewDelegate) is now 14 classes and 3 protocols (WKNavigationDelegate, WKScriptMessageHandler, WKUIDelegate) • Other than class docs (and StackOverflow) , no official “How-To WKWebView” from Apple
a /tmp directory that we can load files from • Alternative: copy files we need to a local webserver running on the device • Fixed in iOS 9 Cannot Load Local File URLs
NSURLRequest sent to delegate methods • Solution: for now leave it -- in line with Android behaviour • Good news: WebKit forums indicate this is a bug and there seems to be a bit of traction
doesn’t participate in state/preservation/restoration • Previously used to reduce memory footprint and prevent crashes • Solution: build our own by saving the last known URL
completes http://www.openradar.me/22855188 • Had to get creative on this one. • Turns out, duplicate <head> tags are ignored… • … so we create a <head> tag at the beginning JUST to scroll back up Views Appear Halfway Down
tabs in a tab bar layout • Bigger problem if you rely on Javascript to run in those webviews • Solution is an off-screen “holding pen” for web views not currently visible
way of doing custom analysis of SSL certificates is broken • webView(_:didReceiveAuthenticationChallenge:completionHandler:) is never called • Important for internal use • No workaround
to background, JS stops executing in ~10sec while native code (and JS in UIWebView) keeps running for ~3 min until completely suspended by OS. • Unlike UIWebView, the webView.URL property is updated to the navigation target before webView:decidePolicyForNavigationAction:decisionHandler in WKWebView. • App store links don’t work by default -- have to intercept requests (http://atmarkplant.com/ios-wkwebview-tips/#applink)