comparison LazyBear/Views/Company/Helpers/ChartHelper.swift @ 444:428109b1e3f0

InsiderTransactions implemented
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Tue, 22 Jun 2021 16:54:21 +0200
parents 417148200aaf
children
comparison
equal deleted inserted replaced
443:ffbb1dbab531 444:428109b1e3f0
15 CustomRectangleBox() 15 CustomRectangleBox()
16 .frame(height: 270) 16 .frame(height: 270)
17 .overlay( 17 .overlay(
18 VStack { 18 VStack {
19 if let quote = company.data.quote?.first { 19 if let quote = company.data.quote?.first {
20 HStack(alignment: .center) { 20 Text("\(quote.latestPrice ?? 0, specifier: "%.2f")")
21 Text("\(quote.latestPrice ?? 0, specifier: "%.2f")") 21 .font(.title2)
22 .foregroundColor(quote.changePercent ?? 0 < 0 ? .red: .green) 22 .fontWeight(.semibold)
23 .fontWeight(.semibold) 23 .foregroundColor(quote.changePercent ?? 0 < 0 ? .red: .green)
24 .padding(.top)
24 25
26 HStack {
25 Text("\(quote.changePercent ?? 0 * 100, specifier: "%.2f")%") 27 Text("\(quote.changePercent ?? 0 * 100, specifier: "%.2f")%")
26 .foregroundColor(quote.changePercent ?? 0 < 0 ? .red: .green) 28 .foregroundColor(quote.changePercent ?? 0 < 0 ? .red: .green)
27 .font(.callout) 29 .font(.caption)
28 .fontWeight(.semibold) 30 .fontWeight(.semibold)
29 31
30 Spacer() 32 Text("1 day")
33 .font(.caption)
34 .opacity(0.5)
31 } 35 }
32 .padding() 36 .padding(.horizontal)
37
38 Spacer()
39
33 40
34 if let historicalPrices = company.data.historicalPrices { 41 if let historicalPrices = company.data.historicalPrices {
35 let prices = historicalPrices.compactMap { $0.close } 42 let prices = historicalPrices.compactMap { $0.close }
36 let dates = historicalPrices.compactMap { $0.date } 43 let dates = historicalPrices.compactMap { $0.date }
37 if company.showChart { 44 if company.showChart {