Mercurial > public > lazybear
diff LazyBear/Views/Company/CompanyView.swift @ 439:aa1f4b614b2b
Implementing CompanyView
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sun, 20 Jun 2021 14:31:39 +0200 |
parents | 7f2a24a774eb |
children | 01fa77358b82 |
line wrap: on
line diff
--- a/LazyBear/Views/Company/CompanyView.swift Sun Jun 20 13:20:19 2021 +0200 +++ b/LazyBear/Views/Company/CompanyView.swift Sun Jun 20 14:31:39 2021 +0200 @@ -8,19 +8,44 @@ import SwiftUI struct CompanyView: View { + var symbol: String + var name: String + @ObservedObject var company = Company() var body: some View { - NavigationView { - VStack { - RowShape() + if company.showView { + NavigationView { + ScrollView { + VStack { + HStack { + Text(name.capitalized) + .font(.title) + .fontWeight(.semibold) + .lineLimit(1) + + Spacer() + } + .padding(.horizontal) + + ChartHelper(quote: company.data.quote, historicalPrices: company.data.historicalPrices) + KeyStatsHelper(keyStats: company.data.keyStats) + } + } + .background(Color(.systemGray6).edgesIgnoringSafeArea(.all)) + .navigationTitle(symbol.uppercased()) } + } else { + ProgressView() + .onAppear { + company.request("https://api.lazybear.app/company/symbol=aapl", .initial) + } } } } struct CompanyView_Previews: PreviewProvider { static var previews: some View { - CompanyView() + CompanyView(symbol: "aapl", name: "apple inc") } }