---
title: maxLength
framework: homekit
role: symbol
role_heading: Instance Property
path: homekit/hmcharacteristicmetadata/maxlength
---

# maxLength

The maximum number of UTF-8 characters allowed in a characteristic that uses a string format.

## Declaration

```swift
var maxLength: NSNumber? { get }
```

## Discussion

Discussion This value only applies to characteristics with a string type.

## See Also

### Bounding the value

- [validValues](homekit/hmcharacteristicmetadata/validvalues.md)
- [minimumValue](homekit/hmcharacteristicmetadata/minimumvalue.md)
- [maximumValue](homekit/hmcharacteristicmetadata/maximumvalue.md)
- [stepValue](homekit/hmcharacteristicmetadata/stepvalue.md)
