---
title: NSCell
framework: appkit
role: symbol
role_heading: Class
path: appkit/nscell
---

# NSCell

A mechanism for displaying text or images in a view object without the overhead of a full NSView subclass.

## Declaration

```swift
@MainActor class NSCell
```

## Overview

Overview Cells are used by most of the NSControl classes to implement their internal workings. Designated Initializers When subclassing NSCell you must implement all of the designated initializers. Those methods include init(), init(coder:), init(textCell:), and init(imageCell:).

## Topics

### Initializing a Cell

- [init(imageCell:)](appkit/nscell/init(imagecell:).md)
- [init(textCell:)](appkit/nscell/init(textcell:).md)

### Managing Cell Values

- [objectValue](appkit/nscell/objectvalue.md)
- [hasValidObjectValue](appkit/nscell/hasvalidobjectvalue.md)
- [intValue](appkit/nscell/intvalue.md)
- [integerValue](appkit/nscell/integervalue.md)
- [stringValue](appkit/nscell/stringvalue.md)
- [doubleValue](appkit/nscell/doublevalue.md)
- [floatValue](appkit/nscell/floatvalue.md)

### Managing Cell Attributes

- [setCellAttribute(_:to:)](appkit/nscell/setcellattribute(_:to:).md)
- [cellAttribute(_:)](appkit/nscell/cellattribute(_:).md)
- [type](appkit/nscell/type.md)
- [isEnabled](appkit/nscell/isenabled.md)
- [allowsUndo](appkit/nscell/allowsundo.md)

### Managing Display Attributes

- [isBezeled](appkit/nscell/isbezeled.md)
- [isBordered](appkit/nscell/isbordered.md)
- [isOpaque](appkit/nscell/isopaque.md)
- [controlTint](appkit/nscell/controltint.md)
- [backgroundStyle](appkit/nscell/backgroundstyle.md)
- [interiorBackgroundStyle](appkit/nscell/interiorbackgroundstyle.md)
- [NSView.BackgroundStyle](appkit/nsview/backgroundstyle.md)

### Managing Cell State

- [allowsMixedState](appkit/nscell/allowsmixedstate.md)
- [nextState](appkit/nscell/nextstate.md)
- [setNextState()](appkit/nscell/setnextstate().md)
- [state](appkit/nscell/state.md)
- [NSControl.StateValue](appkit/nscontrol/statevalue.md)

### Modifying Textual Attributes

- [isEditable](appkit/nscell/iseditable.md)
- [isSelectable](appkit/nscell/isselectable.md)
- [isScrollable](appkit/nscell/isscrollable.md)
- [alignment](appkit/nscell/alignment.md)
- [font](appkit/nscell/font.md)
- [lineBreakMode](appkit/nscell/linebreakmode.md)
- [truncatesLastVisibleLine](appkit/nscell/truncateslastvisibleline.md)
- [wraps](appkit/nscell/wraps.md)
- [baseWritingDirection](appkit/nscell/basewritingdirection.md)
- [attributedStringValue](appkit/nscell/attributedstringvalue.md)
- [allowsEditingTextAttributes](appkit/nscell/allowseditingtextattributes.md)
- [importsGraphics](appkit/nscell/importsgraphics.md)
- [setUpFieldEditorAttributes(_:)](appkit/nscell/setupfieldeditorattributes(_:).md)
- [title](appkit/nscell/title.md)

### Managing the Target and Action

- [action](appkit/nscell/action.md)
- [target](appkit/nscell/target.md)
- [isContinuous](appkit/nscell/iscontinuous.md)
- [sendAction(on:)](appkit/nscell/sendaction(on:).md)

### Managing the Image

- [image](appkit/nscell/image.md)

### Managing the Tag

- [tag](appkit/nscell/tag.md)

### Formatting and Validating Data

- [formatter](appkit/nscell/formatter.md)

### Managing Menus

- [defaultMenu](appkit/nscell/defaultmenu.md)
- [menu](appkit/nscell/menu.md)
- [menu(for:in:of:)](appkit/nscell/menu(for:in:of:).md)

### Comparing Cells

- [compare(_:)](appkit/nscell/compare(_:).md)

### Respond to Keyboard Events

- [acceptsFirstResponder](appkit/nscell/acceptsfirstresponder.md)
- [showsFirstResponder](appkit/nscell/showsfirstresponder.md)
- [refusesFirstResponder](appkit/nscell/refusesfirstresponder.md)
- [performClick(_:)](appkit/nscell/performclick(_:).md)

### Deriving Values

- [takeObjectValueFrom(_:)](appkit/nscell/takeobjectvaluefrom(_:).md)
- [takeIntegerValueFrom(_:)](appkit/nscell/takeintegervaluefrom(_:).md)
- [takeIntValueFrom(_:)](appkit/nscell/takeintvaluefrom(_:).md)
- [takeStringValueFrom(_:)](appkit/nscell/takestringvaluefrom(_:).md)
- [takeDoubleValueFrom(_:)](appkit/nscell/takedoublevaluefrom(_:).md)
- [takeFloatValueFrom(_:)](appkit/nscell/takefloatvaluefrom(_:).md)

### Representing an Object

- [representedObject](appkit/nscell/representedobject.md)

### Tracking the Mouse

- [trackMouse(with:in:of:untilMouseUp:)](appkit/nscell/trackmouse(with:in:of:untilmouseup:).md)
- [startTracking(at:in:)](appkit/nscell/starttracking(at:in:).md)
- [continueTracking(last:current:in:)](appkit/nscell/continuetracking(last:current:in:).md)
- [stopTracking(last:current:in:mouseIsUp:)](appkit/nscell/stoptracking(last:current:in:mouseisup:).md)
- [mouseDownFlags](appkit/nscell/mousedownflags.md)
- [prefersTrackingUntilMouseUp](appkit/nscell/preferstrackinguntilmouseup.md)
- [getPeriodicDelay(_:interval:)](appkit/nscell/getperiodicdelay(_:interval:).md)

### Hit Testing

- [hitTest(for:in:of:)](appkit/nscell/hittest(for:in:of:).md)

### Managing the Cursor

- [resetCursorRect(_:in:)](appkit/nscell/resetcursorrect(_:in:).md)

### Handling Keyboard Alternatives

- [keyEquivalent](appkit/nscell/keyequivalent.md)

### Dragging Cells

- [draggingImageComponents(withFrame:in:)](appkit/nscell/draggingimagecomponents(withframe:in:).md)

### Managing Focus Rings

- [drawFocusRingMask(withFrame:in:)](appkit/nscell/drawfocusringmask(withframe:in:).md)
- [focusRingMaskBounds(forFrame:in:)](appkit/nscell/focusringmaskbounds(forframe:in:).md)
- [defaultFocusRingType](appkit/nscell/defaultfocusringtype.md)
- [focusRingType](appkit/nscell/focusringtype.md)

### Determining Cell Size

- [calcDrawInfo(_:)](appkit/nscell/calcdrawinfo(_:).md)
- [cellSize](appkit/nscell/cellsize.md)
- [cellSize(forBounds:)](appkit/nscell/cellsize(forbounds:).md)
- [drawingRect(forBounds:)](appkit/nscell/drawingrect(forbounds:).md)
- [imageRect(forBounds:)](appkit/nscell/imagerect(forbounds:).md)
- [titleRect(forBounds:)](appkit/nscell/titlerect(forbounds:).md)
- [controlSize](appkit/nscell/controlsize.md)

### Drawing and Highlighting

- [draw(withFrame:in:)](appkit/nscell/draw(withframe:in:).md)
- [highlightColor(withFrame:in:)](appkit/nscell/highlightcolor(withframe:in:).md)
- [drawInterior(withFrame:in:)](appkit/nscell/drawinterior(withframe:in:).md)
- [controlView](appkit/nscell/controlview.md)
- [highlight(_:withFrame:in:)](appkit/nscell/highlight(_:withframe:in:).md)
- [isHighlighted](appkit/nscell/ishighlighted.md)

### Editing and Selecting Text

- [edit(withFrame:in:editor:delegate:event:)](appkit/nscell/edit(withframe:in:editor:delegate:event:).md)
- [select(withFrame:in:editor:delegate:start:length:)](appkit/nscell/select(withframe:in:editor:delegate:start:length:).md)
- [sendsActionOnEndEditing](appkit/nscell/sendsactiononendediting.md)
- [endEditing(_:)](appkit/nscell/endediting(_:).md)
- [wantsNotificationForMarkedText](appkit/nscell/wantsnotificationformarkedtext.md)
- [fieldEditor(for:)](appkit/nscell/fieldeditor(for:).md)
- [usesSingleLineMode](appkit/nscell/usessinglelinemode.md)

### Managing Expansion Frames

- [expansionFrame(withFrame:in:)](appkit/nscell/expansionframe(withframe:in:).md)
- [draw(withExpansionFrame:in:)](appkit/nscell/draw(withexpansionframe:in:).md)

### User Interface Layout Direction

- [userInterfaceLayoutDirection](appkit/nscell/userinterfacelayoutdirection.md)

### Constants

- [NSCell.CellType](appkit/nscell/celltype.md)
- [NSCell.Attribute](appkit/nscell/attribute.md)
- [NSControl.ImagePosition](appkit/nscontrol/imageposition.md)
- [NSImageScaling](appkit/nsimagescaling.md)
- [NSCell.StateValue](appkit/nscell/statevalue.md)
- [NSCell.StyleMask](appkit/nscell/stylemask.md)
- [NSControlTint](appkit/nscontroltint.md)
- [NSControl.ControlSize](appkit/nscontrol/controlsize-swift.enum.md)
- [NSCell.HitResult](appkit/nscell/hitresult.md)
- [NSView.BackgroundStyle](appkit/nsview/backgroundstyle.md)
- [Deprecated Scaling Constants](appkit/deprecated-scaling-constants.md)
- [Data Entry Types](appkit/data-entry-types.md)

### Notifications

- [currentControlTintDidChangeNotification](appkit/nscolor/currentcontroltintdidchangenotification.md)

### Initializers

- [init()](appkit/nscell/init().md)
- [init(coder:)](appkit/nscell/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [NSActionCell](appkit/nsactioncell.md)
- [NSBrowserCell](appkit/nsbrowsercell.md)
- [NSImageCell](appkit/nsimagecell.md)
- [NSTextAttachmentCell](appkit/nstextattachmentcell-swift.class.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)

## See Also

### View fundamentals

- [NSView](appkit/nsview.md)
- [NSControl](appkit/nscontrol.md)
- [NSActionCell](appkit/nsactioncell.md)
