<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSMeasurement",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMeasurement"
  },
  "title" : "NSMeasurement"
}
-->

# NSMeasurement

A numeric quantity labeled with a unit of measure, with support for unit conversion and unit-aware calculations.

```
class NSMeasurement
```

## Overview

Use this object in Swift when you need reference semantics or other Foundation-specific behavior.

An [`NSMeasurement`](/documentation/Foundation/NSMeasurement) object represents a quantity and unit of measure. The [`NSMeasurement`](/documentation/Foundation/NSMeasurement) class provides a programmatic interface to converting measurements into different units, as well as calculating the sum or difference between two measurements.

[`NSMeasurement`](/documentation/Foundation/NSMeasurement) objects are initialized with an [`Unit`](/documentation/Foundation/Unit) object and `double` value. [`NSMeasurement`](/documentation/Foundation/NSMeasurement) objects are immutable, and cannot be changed after being created.

You can use the [`MeasurementFormatter`](/documentation/Foundation/MeasurementFormatter) class to create localized string representations of [`NSMeasurement`](/documentation/Foundation/NSMeasurement) objects.

> Important:
> The Swift overlay to the Foundation framework provides the ``doc://com.apple.foundation/documentation/Foundation/Measurement`` structure, which bridges to the ``doc://com.apple.foundation/documentation/Foundation/NSMeasurement`` class. For more information about value types, see <doc://com.apple.documentation/documentation/Swift/working-with-foundation-types>.

## Topics

### Creating Measurements

[`-  initWithDoubleValue:unit:`](/documentation/Foundation/NSMeasurement/init(doubleValue:unit:))

Initializes a new measurement with a specified double-precision floating-point value and unit.

### Accessing Unit and Value

[`unit`](/documentation/Foundation/NSMeasurement/unit)

The unit of measure.

[`doubleValue`](/documentation/Foundation/NSMeasurement/doubleValue)

The measurement value, represented as a double-precision floating-point number.

### Converting to Other Units

[`-  canBeConvertedToUnit:`](/documentation/Foundation/NSMeasurement/canBeConverted(to:))

Indicates whether the measurement can be converted to the given unit.

[`-  measurementByConvertingToUnit:`](/documentation/Foundation/NSMeasurement/converting(to:))

Returns a measurement created by converting the receiver to the specified unit.

### Operating on Measurements

[`-  measurementByAddingMeasurement:`](/documentation/Foundation/NSMeasurement/adding(_:))

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

[`-  measurementBySubtractingMeasurement:`](/documentation/Foundation/NSMeasurement/subtracting(_:))

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

## Relationships

### Conforms To

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`Escapable`](/documentation/Swift/Escapable)

[`Hashable`](/documentation/Swift/Hashable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`Copyable`](/documentation/Swift/Copyable)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)