Skip to content

Instantly share code, notes, and snippets.

@AminPlusPlus
Last active July 9, 2020 02:19
Show Gist options
  • Save AminPlusPlus/c316baaf48032525d20f31c4344bc8a7 to your computer and use it in GitHub Desktop.
Save AminPlusPlus/c316baaf48032525d20f31c4344bc8a7 to your computer and use it in GitHub Desktop.
Setup CBCentralManager
override func viewDidLoad() {
super.viewDidLoad()
//Start manager
cbCentralManager = CBCentralManager(delegate: self, queue: nil)
}
extension ViewController : CBCentralManagerDelegate {
func centralManagerDidUpdateState(_ central: CBCentralManager) {
if central.state == .poweredOn {
central.scanForPeripherals(withServices: nil, options: nil)
print("Scanning...")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment