From 583eb8b2b84b85db07db94662d3351df57dd22a5 Mon Sep 17 00:00:00 2001 From: Matt Kiazyk Date: Sun, 27 Dec 2020 08:49:15 -0600 Subject: [PATCH] PR List tab Tweaks --- Xcodes/Frontend/XcodeList/XcodeListView.swift | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Xcodes/Frontend/XcodeList/XcodeListView.swift b/Xcodes/Frontend/XcodeList/XcodeListView.swift index e8dc8cd..6c27885 100644 --- a/Xcodes/Frontend/XcodeList/XcodeListView.swift +++ b/Xcodes/Frontend/XcodeList/XcodeListView.swift @@ -8,7 +8,7 @@ struct XcodeListView: View { @State private var rowBeingConfirmedForUninstallation: AppState.XcodeVersion? @State private var searchText: String = "" - @AppStorage("listCategory") private var category: Category = .all + @AppStorage("xcodeListCategory") private var category: Category = .all var visibleVersions: [AppState.XcodeVersion] { var versions: [AppState.XcodeVersion] @@ -26,9 +26,18 @@ struct XcodeListView: View { return versions } - enum Category: String, CaseIterable { - case all = "All" - case installed = "Installed" + enum Category: String, CaseIterable, Identifiable, CustomStringConvertible { + case all + case installed + + var id: Self { self } + + var description: String { + switch self { + case .all: return "All" + case .installed: return "Installed" + } + } } var body: some View { @@ -82,7 +91,7 @@ struct XcodeListView: View { ToolbarItem(placement: .principal) { Picker("", selection: $category) { ForEach(Category.allCases, id: \.self) { - Text($0.rawValue).tag($0) + Text($0.description).tag($0) } } .pickerStyle(SegmentedPickerStyle())