Foundation has a wonderfully useful support for dealing with measurements like distances, durations, temperatures and more in Swift. The Measurement class combines with a Unit type to constrain the measurements into their own domains. With this you can get functionality like conversion and addition. With MeasurementFormatter we can format these values for display in our UI based on the user's locale. In this episode we will explore how to use this API, how to extend the existing dimensions to add new measurement values, and how to create your own domain of measurements. For this we will model Throughput of Items in the game Factorio.
Episode Links Measurement - Apple Developer Documentation Factorio - A truly excellent game based on resource gathering and automation production of products. We use this as a model for our custom Measurement unit domain.