Branch | Status |
---|---|
master |
|
develop |
GLExtendedWebView is a drop-in, ready to use, WKWebView
subclass that brings Interface Builder compatibility to WKWebView
, something that Apple seems to have forgot.
If you try to create a WKWebView
using Interface Builder and you look for it in the object library the only thing you would find is UIWebView
which Apple itself does not recommend:
From Apple's WKWebView
documentation:
Important
Starting in iOS 8.0 and OS X 10.10, use WKWebView to add web content to your app. Do not use UIWebView or WebView.
another thing you would try at this point is to create a UIView
and change its class to WKWebView
but also won't work because the required method:
init?(coder: NSCoder)
has not been implemented in WKWebView
. So in the end you will probably end up creating it programmatically in your UIViewController
, but, unless you also apply some NSLayoutConstraint
s manually, it won't fit the screen on every device and/or update automatically upon rotation.
- Download the project
- Add the
GLExtendedWebView
class to your project - Add a
UIView
in yourUIViewController
- Change the
UIView
class toGLExtendedWebView
- Apply the required
NSLayoutConstraint
using the Interface Builder
- Xcode 9.0+
- Swift 4.0+
- iOS 9.0+