Try and reduce device switching crashing a bit

This commit is contained in:
Garth Vander Houwen 2024-02-12 22:31:03 -08:00
parent c14ff8d075
commit 3f4f493d69

View file

@ -216,8 +216,10 @@ struct Connect: View {
if bleManager.connectedPeripheral != nil && bleManager.connectedPeripheral.peripheral.state == CBPeripheralState.connected {
bleManager.disconnectPeripheral()
}
context.reset()
do {
PersistenceController.shared.clearDatabase()
} catch let error {
print("💣 Failed to re-create CoreData database: " + error.localizedDescription)
}