---
title: NSTextFieldCell
framework: appkit
role: symbol
role_heading: Class
path: appkit/nstextfieldcell
---

# NSTextFieldCell

An object that enhances the text display capabilities of a cell.

## Declaration

```swift
class NSTextFieldCell
```

## Overview

Overview The NSTextFieldCell class adds to the text display capabilities of the NSCell class by allowing you to set the color of both the text and its background. You can also specify whether the cell draws its background at all. All of the methods declared by this class are also declared by the NSTextField class, which uses NSTextFieldCell objects to draw and edit text. The NSTextField cover methods call the corresponding NSTextFieldCell methods. Placeholder strings, set using the placeholderString or placeholderAttributedString property, appear in the text field cell if the actual string is nil or an empty string. They’re drawn in gray on the cell and aren’t archived in the “pre-10.2” nib format. Designated Initializers When subclassing NSTextFieldCell you must implement the designated initializers init(coder:) and init(textCell:).

## Topics

### Creating a Text Field Cell

- [init(textCell:)](appkit/nstextfieldcell/init(textcell:).md)
- [init(coder:)](appkit/nstextfieldcell/init(coder:).md)

### Setting the Text Color

- [textColor](appkit/nstextfieldcell/textcolor.md)

### Setting the Bezel Style

- [bezelStyle](appkit/nstextfieldcell/bezelstyle.md)
- [NSTextField.BezelStyle](appkit/nstextfield/bezelstyle-swift.enum.md)

### Controlling the Background

- [backgroundColor](appkit/nstextfieldcell/backgroundcolor.md)
- [drawsBackground](appkit/nstextfieldcell/drawsbackground.md)

### Managing the Field Editor

- [setUpFieldEditorAttributes(_:)](appkit/nstextfieldcell/setupfieldeditorattributes(_:).md)
- [setWantsNotificationForMarkedText(_:)](appkit/nstextfieldcell/setwantsnotificationformarkedtext(_:).md)

### Managing Placeholder Strings

- [placeholderString](appkit/nstextfieldcell/placeholderstring.md)
- [placeholderAttributedString](appkit/nstextfieldcell/placeholderattributedstring.md)

### Accessing Input Source Locales

- [allowedInputSourceLocales](appkit/nstextfieldcell/allowedinputsourcelocales.md)

## Relationships

### Inherits From

- [NSActionCell](appkit/nsactioncell.md)

### Inherited By

- [NSComboBoxCell](appkit/nscomboboxcell.md)
- [NSPathComponentCell](appkit/nspathcomponentcell.md)
- [NSSearchFieldCell](appkit/nssearchfieldcell.md)
- [NSSecureTextFieldCell](appkit/nssecuretextfieldcell.md)
- [NSTableHeaderCell](appkit/nstableheadercell.md)
- [NSTokenFieldCell](appkit/nstokenfieldcell.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSAccessibilityElementProtocol](appkit/nsaccessibilityelementprotocol.md)
- [NSAccessibilityProtocol](appkit/nsaccessibilityprotocol.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSUserInterfaceItemIdentification](appkit/nsuserinterfaceitemidentification.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Cell

- [NSSecureTextFieldCell](appkit/nssecuretextfieldcell.md)
