---
title: NLDistanceType
framework: naturallanguage
role: symbol
role_heading: Enumeration
path: naturallanguage/nldistancetype
---

# NLDistanceType

The means of calculating a distance between two locations in a text embedding.

## Declaration

```swift
enum NLDistanceType
```

## Overview

Overview The meaning of an NLDistance is directly related to the NLDistanceType you use when you call a method that uses it. For example, if you use the neighborsForString:maximumCount:distanceType: method and use NLDistanceType.cosine for the distanceType parameter, the method calculates the cosine distance and returns it as an NLDistance.

## Topics

### Distance Types

- [NLDistanceType.cosine](naturallanguage/nldistancetype/cosine.md)

### Initializers

- [init(rawValue:)](naturallanguage/nldistancetype/init(rawvalue:).md)

## Relationships

### Conforms To

- [BitwiseCopyable](swift/bitwisecopyable.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [RawRepresentable](swift/rawrepresentable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
