title: ORSSerialPort serialRead in swift
body: <p>I'm trying to work with ORSSerialPort in Swift. But I have problem with reading data from serial port. The trouble is wrong serialPort function implementation. Maybe this part would be helpful:</p>
  
  <ul>
  <li>(void)serialPort:(ORSSerialPort *)serialPort didReceiveResponse:(NSData *)responseData toRequest:(ORSSerialRequest *)request; </li>
  </ul>
  
  <hr>
  
  <pre><code>//Auduino code. Send data for request.
  int incomingByte = Serial.read();
  if (incomingByte = '1', DEC) {
    Serial.print(h);
    Serial.print(',');
    Serial.print(t);
  </code></pre>
  
  <hr>
  
  <pre><code>//OS X
  class SerialController : NSObject, ORSSerialPortDelegate {
      var port : ORSSerialPort
  
      init(path: String){
          port=ORSSerialPort(path: path)
          port.close()
      }
  
      func open(){
          port.baudRate=9600
          port.delegate=self
          port.open()
      }
  
      func close(){
          port.delegate=nil
          port.close()
      }
  
      func SendString(data: String){
          port.sendData(data.dataUsingEncoding(NSUTF8StringEncoding))
      }
  
    //I'm trying to figure out how do I need to read data from serial 
     func serialPort(serialPort: ORSSerialPort!, idReceiveResponse:(NSData *)responseData         toRequest:(ORSSerialRequest *)request) -&gt; String {
  
          if let string = NSString(data: data, encoding: NSUTF8StringEncoding) {
              println(string)
              return(string)
          }
      }
  </code></pre>
  
  <hr>
  
  <pre><code>    let myPort = SerialController(path: "/dev/tty.usbmodem14141")
  
  
      myPort.open()
      myPort.SendString("1")
      var dataFromSerial = myPort.serialPort //read
  </code></pre>