From 1b7720c9c43a247b960c8d8fa8a025675e7f0eac Mon Sep 17 00:00:00 2001 From: Klaus Dresbach Date: Tue, 3 Sep 2024 10:15:19 +0200 Subject: [PATCH] Prevent a tab item from being set twice (#2166) --- .../Settings/TabbarEntriesSettingsView.swift | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/IceCubesApp/App/Tabs/Settings/TabbarEntriesSettingsView.swift b/IceCubesApp/App/Tabs/Settings/TabbarEntriesSettingsView.swift index 1b6c549d..f5911a00 100644 --- a/IceCubesApp/App/Tabs/Settings/TabbarEntriesSettingsView.swift +++ b/IceCubesApp/App/Tabs/Settings/TabbarEntriesSettingsView.swift @@ -15,27 +15,37 @@ struct TabbarEntriesSettingsView: View { Section { Picker("settings.tabs.first-tab", selection: $tabs.firstTab) { ForEach(Tab.allCases) { tab in - tab.label.tag(tab) + if tab == tabs.firstTab || !tabs.tabs.contains(tab) { + tab.label.tag(tab) + } } } Picker("settings.tabs.second-tab", selection: $tabs.secondTab) { ForEach(Tab.allCases) { tab in - tab.label.tag(tab) + if tab == tabs.secondTab || !tabs.tabs.contains(tab) { + tab.label.tag(tab) + } } } Picker("settings.tabs.third-tab", selection: $tabs.thirdTab) { ForEach(Tab.allCases) { tab in - tab.label.tag(tab) + if tab == tabs.thirdTab || !tabs.tabs.contains(tab) { + tab.label.tag(tab) + } } } Picker("settings.tabs.fourth-tab", selection: $tabs.fourthTab) { ForEach(Tab.allCases) { tab in - tab.label.tag(tab) + if tab == tabs.fourthTab || !tabs.tabs.contains(tab) { + tab.label.tag(tab) + } } } Picker("settings.tabs.fifth-tab", selection: $tabs.fifthTab) { ForEach(Tab.allCases) { tab in - tab.label.tag(tab) + if tab == tabs.fifthTab || !tabs.tabs.contains(tab) { + tab.label.tag(tab) + } } } }