Commit 7e7fd246 by Demid Merzlyakov

IOS-292: fix incorrect temperature on the minutely legend.

parent 4555a346
......@@ -350,13 +350,13 @@ class MinutelyForecastView: UIView {
private func updateTemperatureChart() {
guard
let maxTemp = (minutelyForecast.compactMap{ $0.temp }.max{ $0.value < $1.value} ),
let minTemp = (minutelyForecast.compactMap{ $0.temp }.min{ $0.value < $1.value} )
let maxTemp = (minutelyForecast.compactMap{ $0.temp }.max{ $0 < $1 } ),
let minTemp = (minutelyForecast.compactMap{ $0.temp }.min{ $0 < $1 } )
else {
return
}
var uniqTemps = minutelyForecast.compactMap{ $0.temp }.unique().sorted{$0.value > $1.value}
var uniqTemps = minutelyForecast.compactMap{ $0.temp }.sorted{ $0 > $1 }.map { $0.settingsConverted.shortString }.unique()
if uniqTemps.count > 4 {
let uniqMax = uniqTemps.removeFirst()
let uniqMin = uniqTemps.removeLast()
......@@ -370,9 +370,9 @@ class MinutelyForecastView: UIView {
uniqTemps = [uniqMax, firstHalfTemp, secondHalfTemp, uniqMin]
}
for temp in uniqTemps {
for tempString in uniqTemps {
let label = UILabel()
label.text = temp.settingsConverted.shortString
label.text = tempString
label.font = AppFont.SFPro.regular(size: 10)
label.setContentHuggingPriority(.fittingSizeLevel, for: .vertical)
label.sizeToFit()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment