title: Simple OS X app with WKWebView viewer
body: <p>I’m trying to create simple OS X app (not iOS) with a web viewer using the new <code>WKWebView</code> and the Swift language. I’m hoping to take advantage of the faster performance of the <code>WKWebView</code> class.</p>
  
  <p>In the projects AppDelegate.swift file I have the following code:</p>
  
  <pre><code>import Cocoa
  import WebKit
  
  @NSApplicationMain
  class AppDelegate: NSObject, NSApplicationDelegate {
  
      @IBOutlet weak var window: NSWindow!
      @IBOutlet var containerView : NSView! = nil
  
      var webView: WKWebView?
  
      var url = NSURL(string:"http://www.google.com/")
      var req = NSURLRequest(URL: url)
      self.webView!.loadRequest(req)
  
  }
  </code></pre>
  
  <p>In the MainMenu.xib file I have added a Custom View object to the main window and linked it to the <code>@IBOutlet var containerView</code>.</p>
  
  <p>I’m getting error messages on the last two lines of code:</p>
  
  <p><code>var req = NSURLRequest(URL: url)</code> </p>
  
  <blockquote>
    <p>‘AppDelegate. Type’ does not have a member named ‘url’</p>
  </blockquote>
  
  <p><code>self.webView!.loadRequest(req)</code> </p>
  
  <blockquote>
    <p>Expected declaration</p>
  </blockquote>
  
  <p>Any help would be most appreciated.</p>