Mercurial > public > lazybear
diff LazyBear/Views/Company/Helpers/InsiderList.swift @ 413:2984d8946342
Minor UI changes
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Wed, 09 Jun 2021 10:23:52 +0200 |
parents | a7c9dd0c5822 |
children | 5f21f7c23c5e |
line wrap: on
line diff
--- a/LazyBear/Views/Company/Helpers/InsiderList.swift Tue Jun 08 11:46:58 2021 +0200 +++ b/LazyBear/Views/Company/Helpers/InsiderList.swift Wed Jun 09 10:23:52 2021 +0200 @@ -23,12 +23,12 @@ } // Get total shares owned by the top 10 insiders - let totalPositions = insiderSummary.map { $0.position }.reduce(0, +) + let totalPositions = insiderSummary.map { $0.position ?? 0 }.reduce(0, +) VStack(alignment: .leading, spacing: 20) { ForEach(insiderSummary.prefix(3), id: \.self) { insider in // Compute percentage of ownership for each insider - let percentage = Double(insider.position) / Double(totalPositions) + let percentage = Double(insider.position ?? 0) / Double(totalPositions) InsiderRow(percentageOfWidth: CGFloat(percentage), insiderRoster: insider) } @@ -56,12 +56,12 @@ NavigationView { ScrollView { // Get total shares owned by the top 10 insiders - let totalPositions = insiderSummary.map { $0.position }.reduce(0, +) + let totalPositions = insiderSummary.map { $0.position ?? 0 }.reduce(0, +) VStack(alignment: .leading, spacing: 20) { ForEach(insiderSummary, id: \.self) { insider in // Compute percentage of ownership for each insider - let percentage = Double(insider.position) / Double(totalPositions) + let percentage = Double(insider.position ?? 0) / Double(totalPositions) InsiderRow(percentageOfWidth: CGFloat(percentage), insiderRoster: insider) }