Skip to content

Instantly share code, notes, and snippets.

@charlesmuchene
Last active April 17, 2020 04:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save charlesmuchene/71d99f672a67ba2ef52cf542767bc4a9 to your computer and use it in GitHub Desktop.
Save charlesmuchene/71d99f672a67ba2ef52cf542767bc4a9 to your computer and use it in GitHub Desktop.
iOS as Central - peripheral delegate
// Implement peripheral callback methods
extension SocialService: CBPeripheralDelegate {
func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
// Discover characteristics
}
func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
// Request for TraceCharacteristic value -- TraceToken
}
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
// Voila! Trace Token received
// Do amazing things with it
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment