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

# addRow(with:)

Adds a new row of cells below the last row, using the specified cells.

```
func addRow(with newCells: [NSCell])
```

## Parameters

`newCells`

An array of objects to use to fill the new row, starting with the object at index 0. Each object should be an instance of [`NSCell`](/documentation/AppKit/NSCell) or one of its subclasses (usually [`NSActionCell`](/documentation/AppKit/NSActionCell)). The array should contain a sufficient number of cells to fill the entire row. Extra cells are ignored, unless the matrix is empty. In that case, a matrix is created with one row and enough columns for all the elements of `newCells`.

## Discussion

This method redraws the receiver. Your code may need to send [`sizeToCells()`](/documentation/AppKit/NSMatrix/sizeToCells()) after sending this method to resize the receiver to fit the newly added cells.

---

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)