<!--
{
  "availability" : [
    "macOS: 10.6.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCell/fieldEditor(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCell(im)fieldEditorForView:"
  },
  "title" : "fieldEditor(for:)"
}
-->

# fieldEditor(for:)

Returns a custom field editor for editing in the view.

```
func fieldEditor(for controlView: NSView) -> NSTextView?
```

## Parameters

`controlView`

The view containing cells that require a custom field editor.

## Return Value

A custom field editor. The field editor must have [`isFieldEditor`](/documentation/AppKit/NSTextView/isFieldEditor) set to <doc://com.apple.documentation/documentation/Swift/true>.

## Discussion

This is an override point for `NSCell` subclasses designed to use their own custom field editors. This message is sent to the selected cell of `aControlView` using the [`NSWindow`](/documentation/AppKit/NSWindow) method in [`fieldEditor(_:for:)`](/documentation/AppKit/NSWindow/fieldEditor(_:for:)).

Returning non-`nil` from this method indicates skipping the standard field editor querying processes including [`windowWillReturnFieldEditor(_:to:)`](/documentation/AppKit/NSWindowDelegate/windowWillReturnFieldEditor(_:to:)) delegation.

The default implementation returns `nil`.

---

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)