SwiftyBluetooth v2.2.1 Release Notes

Release Date: 2020-11-20 // over 3 years ago
  • 🛠 Fix peripheral disconnect not always firing


Previous changes from v2.2.0

  • You can now listen to Peripheral disconnection using the Peripheral.PeripheralDisconnected notification center event.

    You can listen to this notification roughly like this:

    NotificationCenter.default.addObserver(forName: Peripheral.PeripheralDisconnected, object: peripheral, queue: nil) { (notif) inif let peripheral = notif.object as? Peripheral { print("Peripheral disconnected") } if let error = notif.userInfo?["error"] as? Error { print("Peripheral disconnected with error") } }
    

    Whereas peripheral is an instance of Peripheral.