title: HTTP Headers w/ NSURLRequest in swift
body: <p>Anybody have an idea how to configure HTTP Headers with NSURLRequest in Swift? I have authentication set up on my server and it only needs a token passed to it but I'm having trouble setting the header</p>
  
  <p>my code: </p>
  
  <pre><code>func getLatestData() {
          var loggedInUsersNumber:String = SharingManager.sharedInstance.userID
          var usersDataPoint:String = StormDataPoint + loggedInUsersNumber
          activityIND.hidden = false
          activityIND.startAnimating()
          let request = NSURLRequest(URL: NSURL(string: usersDataPoint)!)
          let tokenString = SharingManager.sharedInstance.authToken
          //request.setValue("Token " + tokenString, forKey: "Authorization")
          let urlSession = NSURLSession.sharedSession()
          let task = urlSession.dataTaskWithRequest(request, completionHandler: {
              (data, response, error) -&gt; Void in
              if let error = error {
                  print(error)
                  return }
  </code></pre>
  
  <p>I created a property "tokenString" to be the token to pass into the header and on the next line where i commented it out. request.setvalue - I popped it in and get an error to the tune of "cannot override data type". All my searches show Objective C help. Is there a better way to try to pass a header in?</p>