Skip to content

Commit

Permalink
Fixed scanResults sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Mar 26, 2023
1 parent 9a34bbb commit ab6abed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion BluetoothExplorer.swiftpm/Views/CentralList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ struct CentralList: View {
var store: Store

var scanResults: [Store.ScanResult] {
return store.scanResults.values.sorted(by: { ($0.name ?? $0.id.description) < ($1.name ?? $1.id.description) })
return store.scanResults
.values
.sorted(by: { $0.id.description < $1.id.description })
.sorted(by: { ($0.name ?? "") < ($1.name ?? "") })
.sorted(by: { $0.name != nil && $1.name == nil })
.sorted(by: { $0.beacon != nil && $1.beacon == nil })
}

var body: some View {
Expand Down

0 comments on commit ab6abed

Please sign in to comment.