mirror of
https://github.com/TuringSoftware/CrystalFetch.git
synced 2024-09-20 06:55:58 +08:00
Merge pull request #20 from pan93412/sort-language-list
feat: sort the language list in details
This commit is contained in:
commit
5de7a87231
|
@ -52,7 +52,7 @@ struct BuildConfigView: View {
|
|||
}.padding(.bottom, 5)
|
||||
Section("Language") {
|
||||
Picker("", selection: $selectedLocale) {
|
||||
ForEach(details.languages) { language in
|
||||
ForEach(details.sortedLanguages) { language in
|
||||
Text(language.display).tag(language.code)
|
||||
}
|
||||
}.onChange(of: selectedLocale) { newValue in
|
||||
|
|
|
@ -32,6 +32,10 @@ struct BuildDetails {
|
|||
let arch: String
|
||||
let build: String
|
||||
let created: Date
|
||||
|
||||
var sortedLanguages: [Language] {
|
||||
return languages.sorted(using: KeyPathComparator(\.display))
|
||||
}
|
||||
|
||||
static var empty = BuildDetails()
|
||||
|
||||
|
|
Loading…
Reference in a new issue