<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSWindowDelegate/windowWillReturnFieldEditor(_:to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSWindowDelegate(im)windowWillReturnFieldEditor:toObject:"
  },
  "title" : "windowWillReturnFieldEditor(_:to:)"
}
-->

# windowWillReturnFieldEditor(_:to:)

Tells the delegate that the field editor for a text-displaying object has been requested.

```
@MainActor optional func windowWillReturnFieldEditor(_ sender: NSWindow, to client: Any?) -> Any?
```

## Parameters

`sender`

The window requesting the field editor from the delegate.

`client`

A text-displaying object to be associated with the field editor. If `nil`, the requested field editor is the default.

## Return Value

The field editor for `client`; returns `nil` when the delegate has no field editor to assign.

## See Also

[`fieldEditor(_:for:)`](/documentation/AppKit/NSWindow/fieldEditor(_:for:))

Returns the window’s field editor, creating it if requested.



---

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)