The Hype to Swift 3.0 Tutorial Series is Finished!

I think I fixed the issues with adding a WKWebView from the IB library.

1, If you are converting from an old project. Itis important to change all the iOS targets to iOS 11

You may still get a warning
WKWebView before iOS 11.0 (NSCoding support was broken in previous versions)

The gotcha is you also need to make sure the Main.storyboard in IB has the target of 11.

2,
Xcode will give you a number of outlet type/syntax depending on what order you add frameworks.

Before you drag from IB to the ViewController.swift to get the outlet. Make sure you have first added the import WebKit in the ViewController.swift code

if you happen to get

@IBOutlet var webView: [WKWebView]!

Change it to

@IBOutlet weak var wkwebview: WKWebView!

You can even type this in and then drag from it to the WKWebView in IB.

iOS_WKWebView_added_frm_Lib.zip (258.0 KB)


Note : if you are deploying to devices before 11, even though you should be able to with the add via IB. You cannot. This seems to be a bug. WKWebView is compatible from iOS 8.x

Creating the WKWebView programmaticly will allow you to deploy for iOS before iOS 11.

3 Likes

Awesome!!
That is a big help and makes things much easier!

1 Like