Merge pull request #20 from pan93412/sort-language-list

feat: sort the language list in details
This commit is contained in:
osy 2023-09-04 13:22:07 -07:00 committed by GitHub
commit 5de7a87231
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -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

View file

@ -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()