Sort hosts ignoring case
This commit is contained in:
parent
7abfc544f6
commit
b7dc72a5e9
|
@ -30,7 +30,7 @@ import SwiftyBeaver
|
|||
private let log = SwiftyBeaver.self
|
||||
|
||||
class ImportedHostsViewController: UITableViewController {
|
||||
private lazy var pendingConfigurationURLs = TransientStore.shared.service.pendingConfigurationURLs().sorted { $0.normalizedFilename < $1.normalizedFilename }
|
||||
private lazy var pendingConfigurationURLs = TransientStore.shared.service.pendingConfigurationURLs().sortedCaseInsensitive()
|
||||
|
||||
private var parsedFile: ParsedFile?
|
||||
|
||||
|
|
|
@ -56,8 +56,8 @@ class OrganizerViewController: UITableViewController, TableModelHost {
|
|||
}()
|
||||
|
||||
func reloadModel() {
|
||||
providers = service.ids(forContext: .provider).sorted()
|
||||
hosts = service.ids(forContext: .host).sorted()
|
||||
providers = service.ids(forContext: .provider)
|
||||
hosts = service.ids(forContext: .host).sortedCaseInsensitive()
|
||||
|
||||
var providerRows = [RowType](repeating: .profile, count: providers.count)
|
||||
var hostRows = [RowType](repeating: .profile, count: hosts.count)
|
||||
|
|
|
@ -33,7 +33,7 @@ class WizardHostViewController: UITableViewController, TableModelHost, Wizard {
|
|||
@IBOutlet private weak var itemNext: UIBarButtonItem!
|
||||
|
||||
private let existingHosts: [String] = {
|
||||
return TransientStore.shared.service.ids(forContext: .host).sorted()
|
||||
return TransientStore.shared.service.ids(forContext: .host).sortedCaseInsensitive()
|
||||
}()
|
||||
|
||||
var parsedFile: ParsedFile? {
|
||||
|
|
|
@ -222,3 +222,9 @@ extension URL {
|
|||
return filename.components(separatedBy: CharacterSet.filename.inverted).joined(separator: URL.illegalCharacterFallback)
|
||||
}
|
||||
}
|
||||
|
||||
extension Array where Element: CustomStringConvertible {
|
||||
public func sortedCaseInsensitive() -> [Element] {
|
||||
return sorted { $0.description.lowercased() < $1.description.lowercased() }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue