comparison LazyBear/Views/Company/CompanyView.swift @ 402:8357b101df67

Implementing CompanyView in NavigationLinks
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Fri, 21 May 2021 23:39:40 +0200
parents 6055a867d2b6
children c804ce7a1560
comparison
equal deleted inserted replaced
401:f843c6382529 402:8357b101df67
16 16
17 // Views 17 // Views
18 @State private var showChartView = true 18 @State private var showChartView = true
19 19
20 var body: some View { 20 var body: some View {
21 NavigationView { 21 ScrollView {
22 ScrollView { 22 VStack {
23 VStack { 23 CompanyHeader(symbol: symbol, showViewSelector: $showViewSelector)
24 CompanyHeader(symbol: symbol, showViewSelector: $showViewSelector) 24
25 25 // Chart View
26 // Chart View 26 if showChartView {
27 if showChartView { 27 Chart(company: company, symbol: symbol)
28 Chart(company: company, symbol: symbol)
29 }
30 } 28 }
31 .padding()
32 } 29 }
33 .navigationTitle("Apple inc") 30 .padding()
34 .navigationBarTitleDisplayMode(.inline)
35 } 31 }
36 .actionSheet(isPresented: $showViewSelector) { 32 .actionSheet(isPresented: $showViewSelector) {
37 ActionSheet(title: Text("Select an option"), buttons: [ 33 ActionSheet(title: Text("Select an option"), buttons: [
38 .default(Text("Chart & News")) { showChartView = true }, 34 .default(Text("Chart & News")) { showChartView = true },
39 .cancel() 35 .cancel()