TemperatureUnit

constructor(baseUnit: TemperatureUnit?, toBaseConverter: (Double) -> Double, fromBaseConverter: (Double) -> Double, unitName: String, unitSymbol: String)(source)


constructor(baseUnit: TemperatureUnit, baseUnitEquivalent: Double, name: String, symbol: String)(source)

Convenience constructor for derived temperature units that are a linear scaling of the base unit.

NOTE: This constructor only supports multiplicative conversions (no offset). It is suitable for units that scale linearly with the base unit (e.g., a hypothetical unit that's 1000× Celsius). Do NOT use this constructor for offset-based units like Fahrenheit or Kelvin — those require explicit converters (see Fahrenheit and Kelvin below).

Parameters

baseUnit

the unit to derive from (typically Celsius)

baseUnitEquivalent

how many base unit units equal one of this unit (multiplier)

name

the human-readable name of the unit

symbol

the short symbol used for the unit