From baa24185c5cb0a9e245abf70cc81acea5d2cdd90 Mon Sep 17 00:00:00 2001 From: macmade Date: Wed, 26 Oct 2022 11:46:55 +0200 Subject: [PATCH] Case-insensitive sorting --- Hot/Classes/ApplicationDelegate.swift | 2 +- Hot/Classes/SelectSensorsWindowController.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Hot/Classes/ApplicationDelegate.swift b/Hot/Classes/ApplicationDelegate.swift index 346994c..c4589ea 100644 --- a/Hot/Classes/ApplicationDelegate.swift +++ b/Hot/Classes/ApplicationDelegate.swift @@ -354,7 +354,7 @@ class ApplicationDelegate: NSObject, NSApplicationDelegate, NSWindowDelegate self.sensorViewControllers = controllers self.sensorsMenu.items = items.sorted { - $0.title.compare( $1.title, options: .numeric, range: nil, locale: nil ) == .orderedAscending + $0.title.compare( $1.title, options: [ .numeric, .caseInsensitive ], range: nil, locale: nil ) == .orderedAscending } } diff --git a/Hot/Classes/SelectSensorsWindowController.swift b/Hot/Classes/SelectSensorsWindowController.swift index c72ec7e..182f27c 100644 --- a/Hot/Classes/SelectSensorsWindowController.swift +++ b/Hot/Classes/SelectSensorsWindowController.swift @@ -55,7 +55,7 @@ public class SelectSensorsWindowController: NSWindowController, NSTableViewDeleg self.arrayController.sortDescriptors = [ - NSSortDescriptor( key: "name", ascending: true ), + NSSortDescriptor( key: "name", ascending: true, selector: #selector( NSString.localizedCaseInsensitiveCompare( _: ) ) ), ] self.windowOpenObserver = NotificationCenter.default.addObserver( forName: NSWindow.didBecomeKeyNotification, object: self.window, queue: nil )