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