I'm trying to add a WKWebView as subview:
func loadWebView() {
    let userAgentStr = self.getUserAgent()
    if let url = URL(string: videoURL.stringValue){
        let request  = URLRequest.init(url: url)
        let config = WKWebViewConfiguration()
        self.webView = WKWebView(frame: self.view.frame, configuration: config)
        self.webView.wantsLayer = true
        self.webView.customUserAgent = userAgentStr
        self.webView.load(request)
        self.webView.layer?.backgroundColor = NSColor.green.cgColor
        self.view.addSubview(self.webView)
        self.view.needsDisplay = true
    }
}
But is not showing in the main NSView. but is been add as a subview:
po self.view.subviews
▿ 9 elements
  - 0 : <NSTextField: 0x10050e400>
  - 1 : <NSTextField: 0x10050f7f0>
  - 2 : <NSTextField: 0x10050e8e0>
  - 3 : <NSButton: 0x600003510000>
  - 4 : <NSButton: 0x6000035100b0>
  - 5 : <NSTextField: 0x10050ee00>
  - 6 : <NSButton: 0x600003510160>
  - 7 : <NSView: 0x6000033054a0>
  - 8 : <WKWebView: 0x600003e01400>
I tried to see if I was doing something wrong and add it a NSView as subview:
func loadNSView() {
    let newView = NSView()
    newView.frame = self.view.frame
    newView.wantsLayer = true
    newView.layer?.backgroundColor = NSColor.white.cgColor
    self.view.addSubview(newView)
    self.view.needsDisplay = true
}
and it work just fine.
Any of you knows what I may be doing wrong ? or what can I do to load the WKWebView ?
I'll really appreciate your help.
 
     
    