MeasurementDecorator

public struct MeasurementDecorator<UnitType> where UnitType : Unit

Extending standard structures like Measurement with properties like var meters is convenient:

  • it avoids extracting value without explicit conversion to a certain unit
  • it simplifies getting value from an optional Measurement

But it is also risky because these extensions might conflict with extensions from other libraries or Apple. This decorator mitigates the risk of conflicts while providing a short, readable code.

Typical use cases are:

  • extracting value from a value representing a unit of measure: let optionalDistanceInMeters = distance?.tt.meters
  • performing computations on values representing units of measure: cumulativeDistance += anotherDistance.tt
  • comparing values representing units of measure: if delay < .tt.seconds(5) {}
  • combining value extraction and typecast: let intValue = distance.tt.intValue(in: .meters)
  • Create a MeasurementDecorator given a specified measurement.

    Declaration

    Swift

    public init(measurement: Measurement<UnitType>)
  • Measurement with some UnitType.

    Declaration

    Swift

    public let measurement: Measurement<UnitType>
  • A convenience method to perform both conversion to Int and conversion to the specified unit. let intValue = distance?.tt.intValue(in: .meters)

    Declaration

    Swift

    public func intValue(in unit: UnitType, rounded: FloatingPointRoundingRule = .towardZero) -> Int

    Parameters

    unit

    unit to which a value is converted.

    rounded

    a rule for rounding a floating-point number. By default, it is equal to the FloatingPointRoundingRule.towardZero value.

    Return Value

    measurement value converted to given unit and then to Int.

  • Convenient method to always convert before getting value and allow optional chaining. let optionalFloatValueInMeters = distance?.tt.floatValue(in: .meters)

    Declaration

    Swift

    public func floatValue(in unit: UnitType) -> Float

    Parameters

    unit

    unit type to which a value is converted.

    Return Value

    measurement value converted to given unit and then to Float.

  • Convenient method to always convert before getting value and allow optional chaining. let optionalDoubleValueInMeters = distance?.tt.doubleValue(in: .meters)

    Declaration

    Swift

    public func doubleValue(in unit: UnitType) -> Double

    Parameters

    unit

    unit type to which a value is converted.

    Return Value

    measurement value converted to given unit and then to Double.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kilowattHoursPer100Kilometers(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kilowattHoursPerKilometer(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kilometersPerKilowattHour(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func milesPerKilowattHour(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • Converts a value to kilowatt-hours per 100 kilometers. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kilowattHoursPer100Kilometers: Double { get }
  • Converts a value to kilowatt-hours per kilometer. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kilowattHoursPerKilometer: Double { get }
  • Converts a value to kilometers per kilowatt-hour. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kilometersPerKilowattHour: Double { get }
  • Converts a value to miles per kilowatt-hour. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var milesPerKilowattHour: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func megaJoulePerLiter(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kiloJoulePerLiter(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func joulePerLiter(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kiloCaloriesPerLiter(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func caloriesPerLiter(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • Converts a value to megajoule per liter. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var megaJoulePerLiter: Double { get }
  • Converts a value to kilojoule per liter. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kiloJoulePerLiter: Double { get }
  • Converts a value to joule per liter. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var joulePerLiter: Double { get }
  • Converts a value to kilocalories per liter. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kilocaloriesPerLiter: Double { get }
  • Converts a value to calories per liter. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var caloriesPerLiter: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func litersPerHour(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func gallonsPerHour(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func imperialGallonsPerHour(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • Converts a value to liters per hour. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var litersPerHour: Double { get }
  • Converts a value to gallons per hour. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var gallonsPerHour: Double { get }
  • Converts a value to imperial gallons per hour. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var imperialGallonsPerHour: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func unitRange(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func percent(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    percent value.

    Return Value

    Measurement with the given value.

  • Converts a value to a unit range. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var unitRange: Double { get }
  • Converts a value to percentages. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var percent: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func degrees(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func arcMinutes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func arcSeconds(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func radians(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func gradians(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func revolutions(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • Converts a value to degrees. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var degrees: Double { get }
  • Converts a value to arc minutes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var arcMinutes: Double { get }
  • Converts a value to arc seconds. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var arcSeconds: Double { get }
  • Converts a value to radians. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var radians: Double { get }
  • Converts a value to gradians. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var gradians: Double { get }
  • Converts a value to revolutions. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var revolutions: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func hours(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    hours.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func minutes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    munites.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func seconds(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    seconds.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func milliseconds(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    milliseconds.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func microseconds(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    microseconds.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func nanoseconds(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    nanoseconds.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func picoseconds(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    picoseconds.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation. Converts a value to seconds and uses Date.init(timeIntervalSince1970:) to a Date struct instance.

    Declaration

    Swift

    public static func date(_ value: Date) -> Measurement<UnitType>

    Parameters

    value

    seconds since 1970 (as is Date.init(timeIntervalSince1970:)).

    Return Value

    Measurement with the given value.

  • Converts a value to hours. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var hours: Double { get }
  • Converts a value to minutes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var minutes: Double { get }
  • Converts a value to seconds. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var seconds: Double { get }
  • Converts a value to milliseconds. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var milliseconds: Double { get }
  • Converts a value to microseconds. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var microseconds: Double { get }
  • Converts a value to nanoseconds. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var nanoseconds: Double { get }
  • Converts a value to picoseconds. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var picoseconds: Double { get }
  • Converts a value to seconds and uses Date.init(timeIntervalSince1970:) to a Date struct instance.

    Declaration

    Swift

    public var date: Date { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func megaamperes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kiloamperes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func amperes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func milliamperes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func microamperes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenient way to always convert before extracting the value.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var megaamperes: Double { get }
  • Converts a value to kiloamperes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kiloamperes: Double { get }
  • Converts a value to amperes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var amperes: Double { get }
  • Converts a value to milliamperes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var milliamperes: Double { get }
  • Converts a value to microamperes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var microamperes: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func megavolts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kilovolts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func volts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func millivolts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func microvolts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • Converts a value to megavolts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var megavolts: Double { get }
  • Converts a value to kilovolts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kilovolts: Double { get }
  • Converts a value to volts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var volts: Double { get }
  • Converts a value to millivolts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var millivolts: Double { get }
  • Converts a value to microvolts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var microvolts: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kilojoules(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func joules(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kilocalories(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func calories(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kilowattHours(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • Converts a value to kilojoules. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kilojoules: Double { get }
  • Converts a value to joules. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var joules: Double { get }
  • Converts a value to kilocalories. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kilocalories: Double { get }
  • Converts a value to calories. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var calories: Double { get }
  • Converts a value to kilowatt-hours. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kilowattHours: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func litersPer100Kilometers(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func milesPerImperialGallon(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func milesPerGallon(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • Converts a value to liters per 100 kilometers. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var litersPer100Kilometers: Double { get }
  • Converts a value to miles per imperial gallon. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var milesPerImperialGallon: Double { get }
  • Converts a value to miles per gallon. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var milesPerGallon: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func megameters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kilometers(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func hectometers(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func decameters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func meters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func decimeters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func centimeters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func millimeters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func micrometers(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func nanometers(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func picometers(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func inches(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func feet(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func yards(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func miles(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func scandinavianMiles(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func lightyears(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func nauticalMiles(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func fathoms(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func furlongs(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func astronomicalUnits(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func parsecs(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • Converts a value to megameters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var megameters: Double { get }
  • Converts a value to kilometers. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kilometers: Double { get }
  • Converts a value to hectometers. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var hectometers: Double { get }
  • Converts a value to decameters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var decameters: Double { get }
  • Converts a value to meters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var meters: Double { get }
  • Converts a value to decimeters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var decimeters: Double { get }
  • Converts a value to centimeters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var centimeters: Double { get }
  • Converts a value to millimeters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var millimeters: Double { get }
  • Converts a value to micrometers. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var micrometers: Double { get }
  • Converts a value to nanometers. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var nanometers: Double { get }
  • Converts a value to picometers. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var picometers: Double { get }
  • Converts a value to inches. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var inches: Double { get }
  • Converts a value to feet. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var feet: Double { get }
  • Converts a value to yards. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var yards: Double { get }
  • Converts a value to miles. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var miles: Double { get }
  • Converts a value to Scandinavian miles. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var scandinavianMiles: Double { get }
  • Converts a value to light years. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var lightyears: Double { get }
  • Converts a value to nautical miles. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var nauticalMiles: Double { get }
  • Converts a value to fathoms. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var fathoms: Double { get }
  • Converts a value to furlongs. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var furlongs: Double { get }
  • Converts a value to astronomical units. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var astronomicalUnits: Double { get }
  • Converts a value to parsecs. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var parsecs: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kilograms(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func grams(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func decigrams(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func centigrams(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func milligrams(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func micrograms(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func nanograms(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func picograms(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func ounces(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func pounds(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func stones(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func metricTons(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func shortTons(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func carats(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func ouncesTroy(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func slugs(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • Converts a value to kilograms. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kilograms: Double { get }
  • Converts a value to grams. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var grams: Double { get }
  • Converts a value to decigrams. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var decigrams: Double { get }
  • Converts a value to centigrams. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var centigrams: Double { get }
  • Converts a value to milligrams. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var milligrams: Double { get }
  • Converts a value to micrograms. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var micrograms: Double { get }
  • Converts a value to nanograms. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var nanograms: Double { get }
  • Converts a value to picograms. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var picograms: Double { get }
  • Converts a value to ounces. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var ounces: Double { get }
  • Converts a value to pounds. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var pounds: Double { get }
  • Converts a value to stones. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var stones: Double { get }
  • Converts a value to metric tons. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var metricTons: Double { get }
  • Converts a value to short tons. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var shortTons: Double { get }
  • Converts a value to carats. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var carats: Double { get }
  • Converts a value to ounces troy. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var ouncesTroy: Double { get }
  • Converts a value to slugs. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var slugs: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func terawatts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func gigawatts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func megawatts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kilowatts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func watts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func milliwatts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func microwatts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func nanowatts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func picowatts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func femtowatts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func horsepower(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • Converts a value to terawatts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var terawatts: Double { get }
  • Converts a value to gigawatts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var gigawatts: Double { get }
  • A convenient way to always convert before extracting the value.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var megawatts: Double { get }
  • Converts a value to kilowatts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kilowatts: Double { get }
  • Converts a value to watts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var watts: Double { get }
  • Converts a value to milliwatts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var milliwatts: Double { get }
  • Converts a value to microwatts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var microwatts: Double { get }
  • Converts a value to nanowatts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var nanowatts: Double { get }
  • Converts a value to picowatts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var picowatts: Double { get }
  • Converts a value to femtowatts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var femtowatts: Double { get }
  • Converts a value to horsepower. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var horsepower: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func metersPerSecond(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    meters per second.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public static func metersPerHour(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    meters per hour.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kilometersPerHour(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    kilometers per hour.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func milesPerHour(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    miles per hour.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func knots(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    knots.

    Return Value

    Measurement with the given value.

  • Converts a value to meters per second. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var metersPerSecond: Double { get }
  • Converts a value to meters per hour. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var metersPerHour: Double { get }
  • Converts a value to kilimeters per hour. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kilometersPerHour: Double { get }
  • Converts a value to miles per hour. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var milesPerHour: Double { get }
  • Converts a value to knots. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var knots: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func bytes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    bytes.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kilobytes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    kilobytes.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func megabytes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    megabytes.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func gigabytes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    gigabytes.

    Return Value

    Measurement with the given value.

  • / A convenience method for measurement creation.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public static func terabytes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    terabytes.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public static func petabytes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    petabytes.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public static func exabytes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    exabytes.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public static func zettabytes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    zettabytes.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func yottabytes(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    yottabytes.

    Return Value

    Measurement with the given value.

  • Converts a value to bytes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var bytes: Double { get }
  • Converts a value to kilobytes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed. To simplify the code, keep the data in Measurement and convert using this method whenever need a value.

    Declaration

    Swift

    public var kilobytes: Double { get }
  • Converts a value to megabytes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var megabytes: Double { get }
  • Converts a value to gigabytes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var gigabytes: Double { get }
  • Converts a value to terabytes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var terabytes: Double { get }
  • Converts a value to petabytes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var petabytes: Double { get }
  • Converts a value to exabytes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var exabytes: Double { get }
  • Converts a value to zettabytes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var zettabytes: Double { get }
  • Converts a value to yottabytes. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public var yottabytes: Double { get }
  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func megaliters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func kiloliters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func liters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func deciliters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func centiliters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func milliliters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func cubicKilometers(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func cubicMeters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func cubicDecimeters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func cubicCentimeters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func cubicMillimeters(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func cubicInches(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func cubicFeet(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func cubicYards(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func cubicMiles(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func acreFeet(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func bushels(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func teaspoons(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func tablespoons(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func fluidOunces(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func cups(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func pints(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func quarts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func gallons(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func imperialTeaspoons(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func imperialTablespoons(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func imperialFluidOunces(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func imperialPints(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func imperialQuarts(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func imperialGallons(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • A convenience method for measurement creation.

    Declaration

    Swift

    public static func metricCups(_ value: Double) -> Measurement<UnitType>

    Parameters

    value

    unit range value.

    Return Value

    Measurement with the given value.

  • Converts a value to megaliters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var megaliters: Double { get }
  • Converts a value to kiloliters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var kiloliters: Double { get }
  • Converts a value to liters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var liters: Double { get }
  • Converts a value to deciliters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var deciliters: Double { get }
  • Converts a value to centiliters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var centiliters: Double { get }
  • Converts a value to milliliters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var milliliters: Double { get }
  • Converts a value to cubic kilometers. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var cubicKilometers: Double { get }
  • Converts a value to cubic meters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var cubicMeters: Double { get }
  • Converts a value to cubic decimeters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var cubicDecimeters: Double { get }
  • Converts a value to cubic centimeters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var cubicCentimeters: Double { get }
  • Converts a value to cubic millimeters. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var cubicMillimeters: Double { get }
  • Converts a value to cubic inches. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var cubicInches: Double { get }
  • Converts a value to cubic feet. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var cubicFeet: Double { get }
  • Converts a value to cubic yards. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var cubicYards: Double { get }
  • Converts a value to cubic miles. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var cubicMiles: Double { get }
  • Converts a value to acre feet. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var acreFeet: Double { get }
  • Converts a value to bushels. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var bushels: Double { get }
  • Converts a value to tea spoons. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var teaspoons: Double { get }
  • Converts a value to table spoons. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var tablespoons: Double { get }
  • Converts a value to fluid ounces. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var fluidOunces: Double { get }
  • Converts a value to cups. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var cups: Double { get }
  • Converts a value to pints. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var pints: Double { get }
  • Converts a value to quarts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var quarts: Double { get }
  • Converts a value to gallons. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var gallons: Double { get }
  • Converts a value to imperial tea spoons. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var imperialTeaspoons: Double { get }
  • Converts a value to imperial table spoons. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var imperialTablespoons: Double { get }
  • Converts a value to imperial fluid ounces. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var imperialFluidOunces: Double { get }
  • Converts a value to imperial pints. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var imperialPints: Double { get }
  • Converts a value to imperial quarts. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var imperialQuarts: Double { get }
  • Converts a value to imperial gallons. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var imperialGallons: Double { get }
  • Converts a value to metric cups. The value can be safely extracted after conversion.

    Note

    Getting a value from Measurement without conversion to the expected unit is error-prone. Keep the data in Measurement and convert using this method whenever a value is needed.

    Declaration

    Swift

    public var metricCups: Double { get }