Skip to content

Commit 2d2ec63

Browse files
beachedloudnate
authored andcommitted
Fix for display of glucose (#163)
This should work for mg/dl and mmol/L as there is only ever 3 significant digits at most, sometimes 2 when glucose is <=99mg/dl or <=5.5mmol/L
1 parent f65db57 commit 2d2ec63

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Loop/Views/GlucoseHUDView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ final class GlucoseHUDView: HUDView {
3333
let numberFormatter = NSNumberFormatter()
3434
numberFormatter.numberStyle = .DecimalStyle
3535
numberFormatter.minimumFractionDigits = unit.preferredMinimumFractionDigits
36+
numberFormatter.usesSignificantDigits = true
37+
numberFormatter.minimumSignificantDigits = 2
38+
numberFormatter.maximumSignificantDigits = 3
3639
glucoseLabel.text = numberFormatter.stringFromNumber(glucoseValue.quantity.doubleValueForUnit(unit))
3740

3841
var unitStrings = [unit.glucoseUnitDisplayString]

0 commit comments

Comments
 (0)