sparrowcode / PermissionsKit

Universal API for request permission and get its statuses.
https://x.com/sparrowcode_ios
MIT License
5.67k stars 464 forks source link

Bluetooth status (powered) #305

Open CavalcanteLeo opened 2 years ago

CavalcanteLeo commented 2 years ago

We can check the status o f the bluetooth if it's turned on or off

Should be great to check that too with PermissionsKit

var manager:CBCentralManager!

 viewDidLoad() {      // Or init()
     manager          = CBCentralManager()
     manager.delegate = self
 }

func centralManagerDidUpdateState(_ central: CBCentralManager) {
    switch central.state {
    case .poweredOn:
        break
    case .poweredOff:
        print("Bluetooth is Off.")
        break
    case .resetting:
        break
    case .unauthorized:
        break
    case .unsupported:
        break
    case .unknown:
        break
    default:
        break
    }
}
ivanvorobei commented 2 years ago

Hello! So idea add property about power on and off, right?

CavalcanteLeo commented 2 years ago

yep

CavalcanteLeo commented 2 years ago

I can submit a PR this weekend if it helps

ivanvorobei commented 2 years ago

I can add it myself, thanks for idea. Soon release new version