comparison LazyBear/Views/Company/CompanyView.swift @ 417:5f21f7c23c5e

Add comments and clean code
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Fri, 11 Jun 2021 11:37:42 +0200
parents c804ce7a1560
children 277197ce1416
comparison
equal deleted inserted replaced
416:1662a41e2c1a 417:5f21f7c23c5e
8 import SwiftUI 8 import SwiftUI
9 import StockCharts 9 import StockCharts
10 10
11 struct CompanyView: View { 11 struct CompanyView: View {
12 var symbol: String 12 var symbol: String
13
14 @ObservedObject var company = Company() 13 @ObservedObject var company = Company()
15 @State private var showViewSelector = false 14 @State private var showViewSelector = false
16 15
17 // Views 16 /*
17 Views
18 */
18 @State private var showChartView = true 19 @State private var showChartView = true
19 @State private var showInsiderView = false 20 @State private var showInsiderView = false
20 21
21 var body: some View { 22 var body: some View {
22 ScrollView { 23 ScrollView {
23 VStack { 24 VStack {
24 CompanyHeader(symbol: symbol, showViewSelector: $showViewSelector) 25 CompanyHeader(symbol: symbol, showViewSelector: $showViewSelector)
25 .padding(.bottom) 26 .padding(.bottom)
26 27
27 // Chart View
28 if showChartView { 28 if showChartView {
29 Chart(company: company, symbol: symbol) 29 Chart(company: company, symbol: symbol)
30 } else if showInsiderView { 30 } else if showInsiderView {
31 Insiders(company: company, symbol: symbol) 31 Insiders(company: company, symbol: symbol)
32 } 32 }
41 ]) 41 ])
42 } 42 }
43 } 43 }
44 44
45 /* 45 /*
46 Hide all views to show later the one tapped 46 Hide all views to show the one selected by user
47 */ 47 */
48 private func resetViews() { 48 private func resetViews() {
49 showChartView = false 49 showChartView = false
50 showInsiderView = false 50 showInsiderView = false
51 } 51 }