title: Perform POST request in Swift
body: <p>I am trying to do something like this:</p>
  
  <pre><code>NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]];
  
  request.HTTPMethod = @"POST";
  
  NSString *stringData = @"some data";
  NSData *requestBodyData = [stringData dataUsingEncoding:NSUTF8StringEncoding];
  request.HTTPBody = requestBodyData;
  
  NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:request delegate:self];
  </code></pre>
  
  <p>This is what I have so far:</p>
  
  <pre><code>var url = NSURL(string: "some url")
  var request = NSMutableURLRequest(URL: url)
  request.HTTPMethod = "POST"
  
  var dataString = "some data"
  var requestBodyData: NSData = dataString.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding) as NSData
  
  request.HTTPBody = requestBodyData
  
  var connection = NSURLConnection(request: request, delegate: self, startImmediately: false)
  
  println("sending request...")
  
  connection.start()
  </code></pre>
  
  <p>However, the var requestBodyData: line throws the first stone with "Cannot convert the expression's type NSData to type NSData"</p>
  
  <p>Anyone care to weigh in?</p>