RSDUnitConverter
public struct RSDUnitConverter
RSDUnitConverter
is a static struct for defined unit converters for converting between US English (imperial)
to metric units. This is used to allow for displaying a person’s height or weight in imperial units, while
storing the value in standardized metric units.
-
The converter to use for mass measurements.
Declaration
Swift
public static let poundAndOunces = USCustomaryUnitConverter<UnitMass>(largeUnit: .pounds, smallUnit: .ounces, baseUnit: .kilograms)
-
The converter to use for length measurements.
Declaration
Swift
public static let feetAndInches = USCustomaryUnitConverter<UnitLength>(largeUnit: .feet, smallUnit: .inches, baseUnit: .centimeters)
-
USCustomaryUnitConverter
is generic struct for converting measurements from various units.Note
US Customary and Imperial units measurements are typically shown using alarger
andsmaller
unit such asft, in
orlb, oz
. This converter will convert from a base unit (default will be metric) to two values, a larger and smaller unit, that are added together to represent a measurement. For example,5 ft, 6 in
.Declaration
Swift
public struct USCustomaryUnitConverter<UnitType> where UnitType : Dimension