title: Writing a String to an NSOutputStream in Swift
body: <p>I'm trying to write a <code>String</code> to an <code>NSOutputStream</code> in Swift. Writing Strings that way with Objective C usually works by passing it as NSData</p>
  
  <pre><code>NSData *data = [[NSData alloc] initWithData:[mystring dataUsingEncoding:NSASCIIStringEncoding]];
  [outputStream write:[data bytes] maxLength:[data length]];
  </code></pre>
  
  <p>This does not work with swift</p>
  
  <pre><code>var data: NSData = mystring.dataUsingEncoding(NSUTF8StringEncoding)!
  outputStream.write(data, maxLength: data.length)
  </code></pre>
  
  <p>this yields the error</p>
  
  <blockquote>
    <p>'NSData' is not convertible to 'UnsafePointer'</p>
  </blockquote>
  
  <p>for the line that writes the data to the stream.</p>
  
  <p>How would you write a String to an NSOutputStream in Swift?</p>