I was running into a big issue recently when trying to use the WebView in swift 3.0 and Mac OSX. The issue was that most of the code examples online were old and useless. I could not find any information even on the apple developer website explaining how to setup the Web View properly when developing an OSX mac app and using the WebView module. Anyway here is what I came up with.
This simple code should help you get started:
self.NAMEOFWEBVIEW.mainFrameURL = "http://www.devprocb.com";
You also have to modify your info.plist file to allow non secure websites.
Add a New Row and type ” App Transport Security Settings ”
Click the arrow to the left of App Transport Security Settings so that it is pointing down.
Add a new row.
The Drop down will have a couple of options.
Select “Allow Arbitrary Loads“.
Your info.plist should look like this:
This will help anyone looking to use the webview in their code on swift 3.0 and Mac OS X