<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSMatrix/cellClass",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSMatrix(py)cellClass"
  },
  "title" : "cellClass"
}
-->

# cellClass

The subclass of [`NSCell`](/documentation/AppKit/NSCell) that the matrix uses when creating new (empty) cells.

```
var cellClass: AnyClass { get set }
```

## Discussion

The value of this property should be the id of a subclass of [`NSCell`](/documentation/AppKit/NSCell), which can be obtained by sending the `class` message to either the [`NSCell`](/documentation/AppKit/NSCell) subclass object or to an instance of that subclass. The default cell class is that set with the class method `setCellClass(_:)`, or [`NSActionCell`](/documentation/AppKit/NSActionCell) if no other default cell class has been specified.

You need to use this property only with matrices initialized with [`init(frame:)`](/documentation/AppKit/NSMatrix/init(frame:)), because the other initializers allow you to specify an instance-specific cell class or cell prototype.

## See Also

[`func insertColumn(Int)`](/documentation/AppKit/NSMatrix/insertColumn(_:))

Inserts a new column of cells at the specified location.

[`func addRow()`](/documentation/AppKit/NSMatrix/addRow())

Adds a new row of cells below the last row.

[`func addColumn()`](/documentation/AppKit/NSMatrix/addColumn())

Adds a new column of cells to the right of the last column.

[`func insertRow(Int)`](/documentation/AppKit/NSMatrix/insertRow(_:))

Inserts a new row of cells before the specified row.

[`func makeCell(atRow: Int, column: Int) -> NSCell`](/documentation/AppKit/NSMatrix/makeCell(atRow:column:))

Creates a new cell at the location specified by the given row and column in the receiver.



---

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)