Swift provides a Measurement type that represents a value and its unit. e.g. 2cm.
var v1 = Measurement(value: 1, unit: UnitLength.inches) //1" v1.convert(to: UnitLength.centimeters) //v1 is now in cm var v2 = Measurement(value: 2, unit: UnitLength.inches) //2" v1+v2 //addition
Measurements helps introduce type safety into calculations and reduces conversion errors.