Mercurial > public > lazybear
diff LazyBear/Views/Company/Helpers/StatsView.swift @ 417:5f21f7c23c5e
Add comments and clean code
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Fri, 11 Jun 2021 11:37:42 +0200 |
parents | 1662a41e2c1a |
children | 6dd97877f575 |
line wrap: on
line diff
--- a/LazyBear/Views/Company/Helpers/StatsView.swift Wed Jun 09 20:26:28 2021 +0200 +++ b/LazyBear/Views/Company/Helpers/StatsView.swift Fri Jun 11 11:37:42 2021 +0200 @@ -9,14 +9,16 @@ struct StatsView: View { var keyStats: KeyStatsModel + @Environment(\.presentationMode) private var presentationStatsView + let displayWords: DisplayWordsModel = parseJSON("DisplayWords.json") var body: some View { NavigationView { Form { let mirror = Mirror(reflecting: keyStats) - ForEach(Array(mirror.children), id: \.label) { child in + ForEach(Array(mirror.children), id: \.label) { child in /// Iterate over each variable within the class if let unwrappedValue = unwrapAnyOptional(value: child.value) { HStack { let label = String(child.label!) @@ -62,40 +64,40 @@ struct StatsView_Previews: PreviewProvider { static var previews: some View { StatsView(keyStats: - KeyStatsModel( - companyName: "Apple inc", - employees: 123, - marketcap: 123, - float: 123, - sharesOutstanding: 123, - beta: 123.12, - peRatio: 123.4, - dividendYield: 123.4, - ttmDividendRate: 123.4, - ttmEPS: 123.4, - avg10Volume: 123, - avg30Volume: 123, - day50MovingAvg: 123.4, - day200MovingAvg: 123.4, - week52Change: 123.4, - week52High: 123.4, - week52Low: 123.4, - week52HighSplitAdjustOnly: 123.4, - week52LowSplitAdjustOnly: 123.4, - maxChangePercent: 123.4, - ytdChangePercent: 123.4, - day5ChangePercent: 123.4, - day30ChangePercent: 123.4, - month1ChangePercent: 123.4, - month3ChangePercent: 123.4, - month6ChangePercent: 123.4, - year1ChangePercent: 123.4, - year2ChangePercent: 123.4, - year5ChangePercent: 123.4, - exDividendDate: "2020-01-01", - nextDividendDate: "2020-01-01", - nextEarningsDate: "2020-01-01" - ) + KeyStatsModel( + companyName: "Apple inc", + employees: 123, + marketcap: 123, + float: 123, + sharesOutstanding: 123, + beta: 123.12, + peRatio: 123.4, + dividendYield: 123.4, + ttmDividendRate: 123.4, + ttmEPS: 123.4, + avg10Volume: 123, + avg30Volume: 123, + day50MovingAvg: 123.4, + day200MovingAvg: 123.4, + week52Change: 123.4, + week52High: 123.4, + week52Low: 123.4, + week52HighSplitAdjustOnly: 123.4, + week52LowSplitAdjustOnly: 123.4, + maxChangePercent: 123.4, + ytdChangePercent: 123.4, + day5ChangePercent: 123.4, + day30ChangePercent: 123.4, + month1ChangePercent: 123.4, + month3ChangePercent: 123.4, + month6ChangePercent: 123.4, + year1ChangePercent: 123.4, + year2ChangePercent: 123.4, + year5ChangePercent: 123.4, + exDividendDate: "2020-01-01", + nextDividendDate: "2020-01-01", + nextEarningsDate: "2020-01-01" + ) ) } }