title: Making an async function out of delegate callbacks
body: <p>I want to implement an async/await interface on top of Core Bluetooth. I want to be able to say</p>
  <pre class="lang-swift prettyprint-override"><code>let response = await sendBluetoothCommand(.myCommand)
  </code></pre>
  <p>Now, to send to via BLE, I write</p>
  <pre class="lang-swift prettyprint-override"><code>peripheral.writeValue(bleCommand.payload, for: writeCharacteristic, type: .withResponse)
  </code></pre>
  <p>and then I get the response in the delegate function</p>
  <pre class="lang-swift prettyprint-override"><code>func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) { ... }
  </code></pre>
  <p>Lets assume that the answer I want is the NSData from characteristic, so what I probably want across here is a Task.Handle&lt;Data, Never&gt;?</p>
  <p>How can I make this task in the one function and complete it in the delegate function, so that it can act like in the first example?</p>