title: Swift - NSHTTPCookie is nil
body: <p>I am trying to write a couple cookies in Swift so that when I display a webview, it will be able to read those cookies and react appropriately. I found many examples of how to create the cookie and read the Apple docs but I can not seem to get a valid NSHTTPCookie object. It's always nil.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>let baseHost = "domain.com"
  let oneYearInSeconds = NSTimeInterval(60 * 60 * 24 * 365)
  
  func setCookie(key: String, value: AnyObject) {
      var cookieProps = [
          NSHTTPCookieOriginURL: baseHost,
          NSHTTPCookiePath: "/",
          NSHTTPCookieName: key,
          NSHTTPCookieValue: value,
          NSHTTPCookieSecure: "TRUE",
          NSHTTPCookieExpires: NSDate(timeIntervalSinceNow: oneYearInSeconds)
      ]
  
      var cookie = NSHTTPCookie(properties: cookieProps)
      // This line fails due to the nil cookie
      NSHTTPCookieStorage.sharedHTTPCookieStorage().setCookie(cookie!)
  }
  </code></pre>
  
  <p>My <code>cookie</code> variable is <code>nil</code>. I've tried many combinations of the properties including having both <code>NSHTTPCookieOriginURL</code> and <code>NSHTTPCookieDomain</code>, with and without <code>NSHTTPCookieSecure</code> and even without <code>NSHTTPCookieExpires</code>. Always <code>nil</code>.</p>
  
  <p>Does anyone have any ideas what I'm doing wrong?</p>