title: Communicating with HM10 from iphone swift xcode
body: <p>I want to communicate with my HM10 via iPhone app, I have already created an app to establish the connection with HM10, I am able to send data to Bluetooth but I am not receiving data, Following is the code:-</p>
  
  <p>It doesn't print anything.                                                                                                     </p>
  
  <pre><code> func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
      // notify the delegate in different ways
      // if you don't use one of these, just comment it (for optimum efficiency :])
      let data = characteristic.value
      guard data != nil else { return }
  
      // first the data
      delegate.serialDidReceiveData(data!)
    //  print(data)
  
      // then the string
      if let str = String(data: data!, encoding: String.Encoding.utf8) {
          delegate.serialDidReceiveString(str)
          print("str")
      } else {
          //print("Received an invalid string!") uncomment for debugging
      }
  
      // now the bytes array
      var bytes = [UInt8](repeating: 0, count: data!.count / MemoryLayout&lt;UInt8&gt;.size)
      (data! as NSData).getBytes(&amp;bytes, length: data!.count)
      delegate.serialDidReceiveBytes(bytes)
      print(bytes)
  //    print(delegate.serialDidReceiveData(bytes))
  }
  func serialDidReceiveString(message: String) {
     // Label.text! = message
      print(message)
  </code></pre>