Returns a new measurement by adding the receiver to the specified measurement.
SDKs
- iOS 10.0+
- macOS 10.12+
- Mac Catalyst 13.0+
- tvOS 10.0+
- watchOS 3.0+
Framework
- Foundation
Declaration
func adding(_ measurement: Measurement<Unit>) -> Measurement<Unit>
Parameters
measurement
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.
Discussion
This method raises an invalid
if the receiver cannot be converted to unit.
You can use the can
method, passing the unit of the specified measurement, to determine whether a measurement can be converted to a particular unit before calling this method.