<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSControlTextEditingDelegate/control(_:didFailToFormatString:errorDescription:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSControlTextEditingDelegate(im)control:didFailToFormatString:errorDescription:"
  },
  "title" : "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.

```
@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

<doc://com.apple.documentation/documentation/Swift/true> if the value in the string parameter should be accepted as is; otherwise, <doc://com.apple.documentation/documentation/Swift/false> if the value in the parameter should be rejected.

## 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

  <doc://com.apple.documentation/documentation/Foundation/Formatter/getObjectValue(_:for:errorDescription:)>



---

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)