From e1ecbb3c2f6d37d6b8d7cf2bd949fc5408ab2490 Mon Sep 17 00:00:00 2001 From: bjornoleh Date: Fri, 24 Mar 2023 17:08:38 +0100 Subject: [PATCH] Eventual BG with 1 decimal Added eventualBGFormatter --- FreeAPS/Sources/Modules/Home/View/HomeRootView.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift b/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift index 87a2503ada..a4469955bb 100644 --- a/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift +++ b/FreeAPS/Sources/Modules/Home/View/HomeRootView.swift @@ -32,6 +32,13 @@ extension Home { return formatter } + private var eventualBGFormatter: NumberFormatter { + let formatter = NumberFormatter() + formatter.numberStyle = .decimal + formatter.maximumFractionDigits = 1 + return formatter + } + private var targetFormatter: NumberFormatter { let formatter = NumberFormatter() formatter.numberStyle = .decimal @@ -532,7 +539,7 @@ extension Home { if let eventualBG = state.eventualBG { Text( - "⇢ " + numberFormatter.string( + "⇢ " + eventualBGFormatter.string( from: (state.units == .mmolL ? eventualBG.asMmolL : Decimal(eventualBG)) as NSNumber )! )