Last active
July 9, 2020 02:19
-
-
Save AminPlusPlus/c316baaf48032525d20f31c4344bc8a7 to your computer and use it in GitHub Desktop.
Setup CBCentralManager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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