I am trying to build a simple WKWebView application that will display Google in the WebView. The app works perfectly fine; however, upon implementing the WKWebView, the app no longer shows a window. It just simply launches the app (in the dock) with no NSView in sight.
ViewController.swift
import Cocoa
import WebKit
class ViewController: NSViewController {
var webView: WKWebView?
override func loadView() {
self.webView = WKWebView()
self.view = self.webView!
let url = NSURL(string:"http://www.google.com/")
let req = NSURLRequest(URL: url!)
self.webView!.loadRequest(req)
}
override func viewDidLoad() {
super.viewDidLoad()
}
override var representedObject: AnyObject? {
didSet {
// Update the view, if already loaded.
}
}
}
There doesn't seem to be any further examples online, nor does there seem to be any projects on GitHub.
Thanks. I haven't come across this before.