Working with Measurements in Swift

Episode #462 | 30 minutes | published on September 24, 2020 | Uses Swift-5.3, Xcode-12.0
Subscribers Only
Foundation has a wonderfully useful support for deal 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

blog comments powered by Disqus