Skip to main content

Patches for Foundation's Measurement-Formatter, Just in Kase

In preparation for releasing Kase 3.1, there is this little module that needs to be brought up to date: the "Foundation Patches" for MeasurementFormatter.


Kase, and its former self Dave, has always had a UnitConverter as part of the Formatters feature. Formatters (or Fx for short) format data without altering them offering the user an additional layer of data display options. UnitConverter is one of the built-in Formatters of Kase. It takes advantages of Foundation's functions to support conversions between hundreds of units.

With the then-current iOS 11 and 12 (and probably since iOS 10), there was a number of issues in MeasurementFormatter so i needed to write some patches to remedy them. And in case these issues were fixed in future systems, i also had a switch in Kase Settings to disable the patches.

To illustrate the effect of the patches, there is a dynamic "hint" in the switch's footer showing a sample output with and without the patches:

e.g. With the patches, Cubic Millimeters (mm³) is displayed as:
"Cubic Millimeters (mm³)"

e.g. Without the patches, Cubic Millimeters (mm³) is displayed as:
"cubic centimeters"

i picked the simplest sample that can show if the patches were necessary. i didn't need to go into a measurement and a conversion, since this method had an obvious bug:

func string(from unit: Unit) -> String

It called mm³ a cm³.

Since then, iOS 13 came out and so did Kase 3. i didn't get to update the Patches part however. So, did anything change? i think i need a clearer answer for Kase 3.1.

iOS 13

In iOS 13, Apple seems to have finally fixed the bug on Cubic Millimeters' name. While it doen't look like localized language versions are complete yet (like other units), at least mm³ can be himself/herself now.

Not all is fixed however.

As of 13.4, in addition to some conversion issues with Imperial units in UnitVolume, (i'm not 100% sure these are considered bugs, but Patches are in place to at least clarify the usage.) two units in UnitConcentrationMass still have obvious conversion errors:

  • milligramsPerDeciliter
  • millimolesPerLiter

So the need for patches is reduced; not eliminated. And a new illustration for the Patches switch is needed.

Kase 3.1

Above is Kase 3.1's Settings: Units window, showing the Foundation Patches switch and its updated description/illustration.

The user can see that with the patches turned off:

e.g. "1 g/L" converted to "mg/dL" is (still) "1 g/L".

This update will be included starting in the next TestFlight.


If history is any indication, these bugs will be with us for a little while. But fear nil. We have the patches in place, just in Kase.

There, Kase 3.1 is one step closer to be Done.