Skip to content

Instantly share code, notes, and snippets.

@Kdan
Last active January 24, 2021 18:13
Show Gist options
  • Save Kdan/a04cabdb211aa4cafe76e3b7dff3fe01 to your computer and use it in GitHub Desktop.
Save Kdan/a04cabdb211aa4cafe76e3b7dff3fe01 to your computer and use it in GitHub Desktop.
/// A Facade for the CBCentralManager.
protocol CentralManager {
/// The state of the central manager.
var state: CBManagerState { get }
/// Call this function to scan for bluetooth peripherals.
func scanForPeripherals(withServices serviceUUIDs: [CBUUID]?, options: [String : Any]?)
/// Connect to a peripheral.
func connect(_ peripheral: CBPeripheral, options: [String : Any]?)
}
extension CBCentralManager: CentralManager { }
/// A Facade for the CBPeripheral.
protocol Peripheral {
/// The name of the peripheral
var name: String? { get }
}
extension CBPeripheral: Peripheral { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment