Mercurial > public > lazybear
comparison LazyBear/Views/Global Helpers/StockItem.swift @ 349:5ccceb527178
Implementing new internal API
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Wed, 14 Apr 2021 23:08:26 +0200 |
parents | 80bfa88c6b0f |
children | eb97439e46cd |
comparison
equal
deleted
inserted
replaced
348:0abb8d5c12ec | 349:5ccceb527178 |
---|---|
37 } | 37 } |
38 .padding(.horizontal) | 38 .padding(.horizontal) |
39 | 39 |
40 Spacer() | 40 Spacer() |
41 | 41 |
42 if let prices = intradayPrices?.compactMap { $0.marketOpen } { | 42 if let prices = intradayPrices?.compactMap { $0.open } { |
43 LineView(data: prices) | 43 LineView(data: prices) |
44 .foregroundColor(company.changePercent < 0 ? .red: .green) | 44 .foregroundColor(company.changePercent < 0 ? .red: .green) |
45 .padding(.vertical) | 45 .padding(.vertical) |
46 .clipped() | 46 .clipped() |
47 } | 47 } |
54 | 54 |
55 struct StockItem_Previews: PreviewProvider { | 55 struct StockItem_Previews: PreviewProvider { |
56 static var previews: some View { | 56 static var previews: some View { |
57 StockItem( | 57 StockItem( |
58 company: QuoteModel(companyName: "apple inc", symbol: "aapl", latestPrice: 130.3, changePercent: 0.03), | 58 company: QuoteModel(companyName: "apple inc", symbol: "aapl", latestPrice: 130.3, changePercent: 0.03), |
59 intradayPrices: [IntradayPricesModel(marketOpen: 130.3)] | 59 intradayPrices: [IntradayPricesModel(open: 130.3)] |
60 ) | 60 ) |
61 } | 61 } |
62 } | 62 } |