Format battery voltage with NumberFormatter + " V"#2
Open
loopkitdev wants to merge 1 commit into
Open
Conversation
Replaces the temporary placeholder (commented-out QuantityFormatter, raw `String(format: "%0.2f", voltage)`) with a `NumberFormatter` restoring 2 fraction digits and a `" V"` suffix. LoopUnit has no `.volt` case, so a `QuantityFormatter` (which now takes a `LoopUnit`) can't render the value. `NumberFormatter` matches the original UX (decimal style, 2 fraction digits) and goes through the locale's grouping/decimal separators -- no more raw printf. Applies to both the current-patch and previous-patch detail views; the previous-patch view goes back to calling `viewModel.batteryText` instead of formatting inline.
loopkitdev
pushed a commit
to loopkitdev/LoopWorkspace
that referenced
this pull request
Jun 7, 2026
- MedtrumKit: pin onto loopandlearn/MedtrumKit:loop-next-dev (their fork is the canonical place for the Loop-next-dev adaptation work) plus our voltage-formatter improvement on top, pushed as a PR against loopandlearn (loopandlearn/MedtrumKit#2). - EversenseKit: replace ResizeablePicker (internal to LoopKitUI) with SwiftUI Picker(.wheel) at the 10 call sites across TransmitterSettingsView, DMSSettingsView, CalibrationView, matching the conversion loopandlearn just shipped on MedtrumKit. - LoopKit: revert the ResizeablePicker public-access change -- no external driver needs it anymore now that both MedtrumKit and EversenseKit switched to SwiftUI Picker.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the temporary
String(format: "%0.2f", voltage)placeholder for battery voltage display with aNumberFormatter+Vsuffix.LoopUnit currently has no
.voltcase, soQuantityFormattercan't render volts. A locale-awareNumberFormatterrestores the previous UX (2 fraction digits, decimal style with locale-correct separators) without depending on a unit type we don't have.Applies to both
PatchDetailsViewModelandPreviousPatchDetailsViewModel, and switchesPreviousPatchDetailsViewback to calling the view model'sbatteryText(for:)helper.Test plan
4.10 V(or similar) with locale-correct decimal separatorString(format:)printf for displayed values