Mercurial > public > lazybear
diff LazyBear/Views/Company/CompanyView.swift @ 407:c804ce7a1560
Implementing Insider networking
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sun, 06 Jun 2021 13:11:41 +0200 |
parents | 8357b101df67 |
children | 5f21f7c23c5e |
line wrap: on
line diff
--- a/LazyBear/Views/Company/CompanyView.swift Sat Jun 05 19:05:13 2021 +0200 +++ b/LazyBear/Views/Company/CompanyView.swift Sun Jun 06 13:11:41 2021 +0200 @@ -16,26 +16,39 @@ // Views @State private var showChartView = true + @State private var showInsiderView = false var body: some View { ScrollView { VStack { CompanyHeader(symbol: symbol, showViewSelector: $showViewSelector) + .padding(.bottom) // Chart View if showChartView { Chart(company: company, symbol: symbol) + } else if showInsiderView { + Insiders(company: company, symbol: symbol) } } .padding() } .actionSheet(isPresented: $showViewSelector) { ActionSheet(title: Text("Select an option"), buttons: [ - .default(Text("Chart & News")) { showChartView = true }, + .default(Text("Chart & News")) { resetViews(); showChartView = true }, + .default(Text("Insiders")) { resetViews(); showInsiderView = true }, .cancel() ]) } } + + /* + Hide all views to show later the one tapped + */ + private func resetViews() { + showChartView = false + showInsiderView = false + } } struct CompanyView_Previews: PreviewProvider {