title: Insert Newline and Carriage-Return into Swift String
body: <p>I'm writing an OS X app that interacts with an Arduino UNO via serial connection. It currently has no problem reading strings from the UNO but I can't manage to send it the proper Newline and Carriage-Return characters on outgoing strings.</p>
  
  <p>The code responsible for sending the string is as follows: </p>
  
  <pre><code>    @IBAction func SendCommand(sender: AnyObject) {
      let data = self.sendTextField.stringValue.dataUsingEncoding(NSUTF8StringEncoding)
      self.serialPort?.sendData(data)
  }
  </code></pre>
  
  <p>For the moment I have attempting to manually insert '\r\n' at the end of messages when the program is running. Should this not be equivalent to what the Arduino IDE would do programatically in it's own serial monitor? However my app isn't interpreting these commands as Newline of Carriage-Return characters. Is it only possible programatically and if so how?</p>
  
  <p>Thank you in advance!</p>