diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/SectionHeaderWithRightAlignedEditButton.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/SectionHeaderWithRightAlignedEditButton.swift index 43013d8b..4e926ae3 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/SectionHeaderWithRightAlignedEditButton.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/SectionHeaderWithRightAlignedEditButton.swift @@ -5,15 +5,20 @@ struct SectionHeaderWithRightAlignedEditButton: View { private let sectionTitle: LocalizedStringKey + private let isEditButtonEnabled: Bool - init(_ sectionTitle: LocalizedStringKey) { + + init(_ sectionTitle: LocalizedStringKey, isEditButtonEnabled: Bool = true) { self.sectionTitle = sectionTitle + + self.isEditButtonEnabled = isEditButtonEnabled } var body: some View { EditButton() .frame(maxWidth: .infinity, alignment: .trailing) + .disabled( !isEditButtonEnabled) .overlay(Text(sectionTitle), alignment: .leading) } diff --git a/ui/BankingiOSApp/BankingiOSApp/ui/views/SettingsDialog.swift b/ui/BankingiOSApp/BankingiOSApp/ui/views/SettingsDialog.swift index 576b44f5..07ee8f38 100644 --- a/ui/BankingiOSApp/BankingiOSApp/ui/views/SettingsDialog.swift +++ b/ui/BankingiOSApp/BankingiOSApp/ui/views/SettingsDialog.swift @@ -14,7 +14,7 @@ struct SettingsDialog: View { var body: some View { Form { - Section(header: SectionHeaderWithRightAlignedEditButton("Bank Credentials")) { + Section(header: SectionHeaderWithRightAlignedEditButton("Bank Credentials", isEditButtonEnabled: data.hasAtLeastOneAccountBeenAdded)) { ForEach(data.banksSorted) { bank in NavigationLink(destination: LazyView(BankSettingsDialog(bank))) { IconedTitleView(bank)