<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HealthKit",
  "identifier" : "/documentation/HealthKit/HKUnit/init(from:)-55e1u",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "HealthKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HKUnit(cm)unitFromLengthFormatterUnit:"
  },
  "title" : "init(from:)"
}
-->

# init(from:)

Converts a length formatter enumeration value into a corresponding HealthKit object.

```
convenience init(from lengthFormatterUnit: LengthFormatter.Unit)
```

## Parameters

`lengthFormatterUnit`

A valid length formatter unit value. For a list of possible length formatter unit values, see <doc://com.apple.documentation/documentation/Foundation/LengthFormatter/Unit>.

## Return Value

A HealthKit unit object, or `nil` if the unit parameter is not a valid length formatter unit value.

---

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)