---
title: "addRow(with:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsmatrix/addrow(with:)"
---

# addRow(with:)

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

## Declaration

```swift
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 doc://com.apple.appkit/documentation/AppKit/NSCell or one of its subclasses (usually doc://com.apple.appkit/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

Discussion This method redraws the receiver. Your code may need to send sizeToCells() after sending this method to resize the receiver to fit the newly added cells.

## See Also

### Laying Out the Cells of the Matrix

- [addColumn()](appkit/nsmatrix/addcolumn().md)
- [addColumn(with:)](appkit/nsmatrix/addcolumn(with:).md)
- [addRow()](appkit/nsmatrix/addrow().md)
- [cellFrame(atRow:column:)](appkit/nsmatrix/cellframe(atrow:column:).md)
- [cellSize](appkit/nsmatrix/cellsize.md)
- [getNumberOfRows(_:columns:)](appkit/nsmatrix/getnumberofrows(_:columns:).md)
- [insertColumn(_:)](appkit/nsmatrix/insertcolumn(_:).md)
- [insertColumn(_:with:)](appkit/nsmatrix/insertcolumn(_:with:).md)
- [insertRow(_:)](appkit/nsmatrix/insertrow(_:).md)
- [insertRow(_:with:)](appkit/nsmatrix/insertrow(_:with:).md)
- [intercellSpacing](appkit/nsmatrix/intercellspacing.md)
- [makeCell(atRow:column:)](appkit/nsmatrix/makecell(atrow:column:).md)
- [numberOfColumns](appkit/nsmatrix/numberofcolumns.md)
- [numberOfRows](appkit/nsmatrix/numberofrows.md)
- [putCell(_:atRow:column:)](appkit/nsmatrix/putcell(_:atrow:column:).md)
