In everyday life we constantly convert values between different units of measurement. For developers this seems easy—write a few formulas, sprinkle in a couple of switch statements and you’re done. But the moment you try to support dozens of units, seamless internationalisation, formatting, precision and rounding, the workload sky-rockets and the drudgery can make you question your life choices. The good news: starting with iOS 10 Apple added a comprehensive Measurement API to Foundation, taking all that “donkey work” off our hands. This article walks you through its usage and best practices.

    • heydamianc@lemmy.cafe
      link
      fedilink
      English
      arrow-up
      1
      ·
      5 days ago

      The article is more about the strengths of the type system than a single country’s quirks. While I don’t disagree with you, I have to ask…you read the article, right?