RSDMassInputTableItem
public final class RSDMassInputTableItem : RSDTextInputTableItem
A custom implementation for inputing a person’s mass (weight) that can set up a picker for
setting the weight of an infant. Typically, US participants know what their newborn baby’s
weight is in lb and oz. Additionally, the placeholder text for an adult or child measurement
range will be either pounds
or kilograms
, depending upon the participant’s locale.
-
The base unit is the unit of mass that the measurement should be converted to in order to save the result. Because the
Measurementclass has a genericUnitType, it cannot be easily converted to aCodableobject so the results are stored as.decimalbase type with the unit symbol also stored on the result.Declaration
Swift
public let baseUnit: UnitMass -
Default initializer.
Declaration
Swift
public init(rowIndex: Int, inputField: RSDInputField, uiHint: RSDFormUIHint, measurementSize: RSDFormDataType.MeasurementRange)Parameters
rowIndexThe index of this item relative to all rows in the section in which this item resides.
inputFieldThe RSDInputField representing this tableItem.
uiHintThe UI hint for this row of the table.
measurementSizeThe measurement range for the input field.
-
Override the
convertAnswer()function to convert theMeasurementreturned by the formatter into a decimal value in thebaseUnit.Declaration
Swift
override public func convertAnswer(_ newValue: Any) throws -> Any?
View on GitHub
RSDMassInputTableItem Class Reference