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

# addColumn(with:)

Adds a new column of cells to the right of the last column, using the given cells.

## Declaration

```swift
func addColumn(with newCells: [NSCell])
```

## Parameters

- `newCells`: An array of objects to use when filling the new column starting with the object at index 0. Each object in 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 have a sufficient number of cells to fill the entire column. Extra cells are ignored, unless the matrix is empty. In that case, a matrix is created with one column and enough rows 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)
- [addRow()](appkit/nsmatrix/addrow().md)
- [addRow(with:)](appkit/nsmatrix/addrow(with:).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)
