feat: Simple bluetooth status indication

This commit is contained in:
2026-06-07 18:27:33 +01:00
commit 61bf63fd14
9 changed files with 125 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import SwiftUI
import CoreBluetooth
final class BluetoothManager: NSObject, ObservableObject {
private var centralManager: CBCentralManager!
@Published var status = "Starting..."
override init() {
super.init()
centralManager = CBCentralManager(delegate: self, queue: nil)
}
}
extension BluetoothManager: CBCentralManagerDelegate {
func centralManagerDidUpdateState(_ central: CBCentralManager) {
switch central.state {
case .poweredOn:
status = "Bluetooth is on"
default:
status = "Bluetooth unavailable"
}
}
}