From 56bca7f0ad0a08dc1a4a8ceab7765751e05fa720 Mon Sep 17 00:00:00 2001 From: Billy Brawner Date: Tue, 17 May 2022 19:55:59 -0600 Subject: [PATCH] Only show archived categories section when there actually are archived categories --- Twigs/Category/CategoryListView.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Twigs/Category/CategoryListView.swift b/Twigs/Category/CategoryListView.swift index a3bcea6..8ec8911 100644 --- a/Twigs/Category/CategoryListView.swift +++ b/Twigs/Category/CategoryListView.swift @@ -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) + } } } }