Instance Method


Returns a new measurement by adding the receiver to the specified measurement.


func adding(_ measurement: Measurement<Unit>) -> Measurement<Unit>



The measurement to be added.

Return Value

A new measurement with a value equal to the receiver’s value plus the value of the specified measurement converted into the unit of the receiver.


This method raises an invalidArgumentException if the receiver cannot be converted to unit.

You can use the canBeConverted(to:) method, passing the unit of the specified measurement, to determine whether a measurement can be converted to a particular unit before calling this method.

See Also

Operating on Measurements

func subtracting(Measurement<Unit>) -> Measurement<Unit>

Returns a new measurement by subtracting the specified measurement from the receiver.