Mercurial > public > lazybear
diff LazyBear/Views/Global Helpers/StockItem.swift @ 390:6303385b3629
Companies added to watchlists now are correctly updated
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sun, 25 Apr 2021 19:52:04 +0200 |
parents | a7e2c5a7b4f6 |
children | bd34e16b01ad |
line wrap: on
line diff
--- a/LazyBear/Views/Global Helpers/StockItem.swift Sun Apr 25 16:42:26 2021 +0200 +++ b/LazyBear/Views/Global Helpers/StockItem.swift Sun Apr 25 19:52:04 2021 +0200 @@ -60,7 +60,7 @@ .opacity(0.6) .lineLimit(1) - PriceView(latestPrice: company.latestPrice, changePercent: company.changePercent, align: .leading) + PriceView(latestPrice: company.latestPrice ?? 0, changePercent: company.changePercent ?? 0, align: .leading) .padding(.top) } @@ -70,7 +70,7 @@ if let prices = intradayPrices?.compactMap { $0.open } { LineView(data: prices) - .foregroundColor(company.changePercent < 0 ? .red: .green) + .foregroundColor(company.changePercent ?? 0 < 0 ? .red: .green) .padding(.vertical) .clipped() } @@ -105,13 +105,13 @@ if !hidePriceView { if let prices = intradayPrices?.compactMap { $0.open } { LineView(data: prices) - .foregroundColor(company.changePercent < 0 ? .red: .green) + .foregroundColor(company.changePercent ?? 0 < 0 ? .red: .green) .frame(width: 80) .padding(.vertical, 10) .padding(.leading) } - PriceView(latestPrice: company.latestPrice, changePercent: company.changePercent, align: .trailing) + PriceView(latestPrice: company.latestPrice ?? 0, changePercent: company.changePercent ?? 0, align: .trailing) // Center PriceView with the other rows .frame(minWidth: 80, alignment: .trailing) }