Skip to content

Commit e07c77f

Browse files
committed
fix(mac): fix UI not showing connected state due to struct equality check
Since lastSeen was added to DiscoveredDevice, the synthesized Equatable check failed when the array's lastSeen was updated but the connectedDevice's lastSeen wasn't. Changed to compare IP addresses instead.
1 parent a06d384 commit e07c77f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Mac/CarpeCast-Swift/ContentView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ struct DevicesView: View {
2020
}
2121
.frame(maxWidth: .infinity, maxHeight: .infinity)
2222
} else {
23-
List(networkManager.discoveredDevices, id: \.self) { device in
23+
List(networkManager.discoveredDevices, id: \.ip) { device in
2424
HStack {
2525
VStack(alignment: .leading) {
2626
Text(device.name).fontWeight(.bold)
@@ -29,7 +29,7 @@ struct DevicesView: View {
2929
.foregroundColor(.secondary)
3030
}
3131
Spacer()
32-
if networkManager.connectedDevice == device {
32+
if networkManager.connectedDevice?.ip == device.ip {
3333
Text(localized("Connected")).foregroundColor(.green)
3434
Button(localized("Disconnect")) {
3535
networkManager.disconnect()

0 commit comments

Comments
 (0)