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
Measurement
class has a genericUnitType
, it cannot be easily converted to aCodable
object so the results are stored as.decimal
base 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
rowIndex
The index of this item relative to all rows in the section in which this item resides.
inputField
The RSDInputField representing this tableItem.
uiHint
The UI hint for this row of the table.
measurementSize
The measurement range for the input field.
-
Override the
convertAnswer()
function to convert theMeasurement
returned by the formatter into a decimal value in thebaseUnit
.Declaration
Swift
override public func convertAnswer(_ newValue: Any) throws -> Any?