Changes languages so you can remove them.
This commit is contained in:
@@ -20,9 +20,16 @@ struct EditLanguages: View {
|
||||
ForEach(sortedLanguages/*viewModel.languages*/) { language in
|
||||
NavigationLink(language.name, destination: EditLanguage(viewModel: language))
|
||||
}
|
||||
|
||||
.onDelete(perform: { indexSet in
|
||||
for index in indexSet {
|
||||
viewModel.languages.remove(at: index)
|
||||
}
|
||||
})
|
||||
}
|
||||
.toolbar(content: {
|
||||
ToolbarItemGroup(placement: .navigationBarTrailing) {
|
||||
EditButton()
|
||||
|
||||
Button(
|
||||
action: {
|
||||
let newLanguage = LanguageViewModel("English")
|
||||
@@ -33,6 +40,7 @@ struct EditLanguages: View {
|
||||
Image(systemName: "plus")
|
||||
}
|
||||
)
|
||||
}
|
||||
})
|
||||
.onAppear(perform: {
|
||||
viewModel.languages = viewModel.languages.sorted()
|
||||
|
||||
Reference in New Issue
Block a user