Added vibrant selection to Account navigation links

This commit is contained in:
Maurice Parker 2019-09-16 05:30:59 -05:00
parent 8063488bc8
commit e3270f5ef4
1 changed files with 12 additions and 4 deletions

View File

@ -39,16 +39,24 @@ struct SettingsView : View {
}
}
@State private var accountAction: Int? = nil
func buildAccountsSection() -> some View {
Section(header: Text("ACCOUNTS").padding(.top, 22.0)) {
ForEach(viewModel.accounts) { account in
NavigationLink(destination: SettingsDetailAccountView(viewModel: SettingsDetailAccountView.ViewModel(account))) {
Text(verbatim: account.nameForDisplay)
ForEach(0..<viewModel.accounts.count) { index in
NavigationLink(destination: SettingsDetailAccountView(viewModel: SettingsDetailAccountView.ViewModel(self.viewModel.accounts[index])), tag: index, selection: self.$accountAction) {
Text(verbatim: self.viewModel.accounts[index].nameForDisplay)
}
.modifier(VibrantSelectAction(action: {
self.accountAction = index
}))
}
NavigationLink(destination: SettingsAddAccountView()) {
NavigationLink(destination: SettingsAddAccountView(), tag: 1000, selection: $accountAction) {
Text("Add Account")
}
.modifier(VibrantSelectAction(action: {
self.accountAction = 1000
}))
}
}