Mercurial > public > lazybear
changeset 280:6254ae414a50
Fix minor bugs
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Fri, 19 Mar 2021 17:13:45 +0100 |
parents | 6b20a0109829 |
children | 6835e2885aa6 |
files | LazyBear/UI/ChartView.swift |
diffstat | 1 files changed, 9 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/LazyBear/UI/ChartView.swift Fri Mar 19 16:34:46 2021 +0100 +++ b/LazyBear/UI/ChartView.swift Fri Mar 19 17:13:45 2021 +0100 @@ -57,6 +57,7 @@ } } .onAppear { + self.selectedPeriod = 2 let url = getUrl(endpoint: .historicalPrices, symbol: symbol, range: "3m") request(url: url, model: [HistoricalPriceModel].self) { self.historicalPrices = $0 } } @@ -78,8 +79,7 @@ private func rangeEndpointSelector(_ value: Int) -> String { var url = "" - - + if selectedPeriod == 0 { // 1 week url = getUrl(endpoint: .historicalPrices, symbol: symbol, range: selected(interval: .oneWeek)) } else if selectedPeriod == 1 { // 1 month @@ -105,19 +105,16 @@ } private func lineViewSize() -> (CGFloat, CGFloat) { - var divisor: CGFloat = 3 + var width = deviceSize.width + var height = width / 3 // if running on iPad if UIDevice.current.userInterfaceIdiom == .pad { - divisor = 6 - } - - var width = deviceSize.width - var height = deviceSize.width / divisor - - if orientation.isLandscape { - width = deviceSize.height - height = deviceSize.height / divisor + height = width / 6 + if orientation.isLandscape { + width = deviceSize.height + height = width / 6 + } } return (width, height)