---
title: "control(_:didFailToFormatString:errorDescription:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscontroltexteditingdelegate/control(_:didfailtoformatstring:errordescription:)"
---

# control(_:didFailToFormatString:errorDescription:)

Invoked when the formatter for the cell belonging to the specified control cannot convert a string to an underlying object.

## Declaration

```swift
@MainActor optional func control(_ control: NSControl, didFailToFormatString string: String, errorDescription error: String?) -> Bool
```

## Parameters

- `control`: The control whose cell could not convert the string.
- `string`: The string that could not be converted.
- `error`: A localized, user-presentable string that explains why the conversion failed.

## Return Value

Return Value true if the value in the string parameter should be accepted as is; otherwise, false if the value in the parameter should be rejected.

## Discussion

Discussion Your implementation of this method should evaluate the error or query the user an appropriate value indicating whether the string should be accepted or rejected.

## See Also

### Related Documentation

- [getObjectValue(_:for:errorDescription:)](foundation/formatter/getobjectvalue(_:for:errordescription:).md)
