Only show archived categories section when there actually are archived categories

This commit is contained in:
William Brawner 2022-05-17 19:55:59 -06:00
parent 20b685809b
commit 56bca7f0ad

View file

@ -27,9 +27,11 @@ struct CategoryListView: View {
CategoryListItemView(CategoryDataStore(dataStore.apiService), budget: budget, category: category)
}
}
Section("Archived") {
ForEach(categories.filter { $0.archived }) { category in
CategoryListItemView(CategoryDataStore(dataStore.apiService), budget: budget, category: category)
if categories.contains(where: { $0.archived }) {
Section("Archived") {
ForEach(categories.filter { $0.archived }) { category in
CategoryListItemView(CategoryDataStore(dataStore.apiService), budget: budget, category: category)
}
}
}
}