---
title: selectedCells
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nsmatrix/selectedcells
---

# selectedCells

An array containing all of the matrix’s highlighted cells plus its selected cell.

## Declaration

```swift
var selectedCells: [NSCell] { get }
```

## Discussion

Discussion See the class description for a discussion of the selected cell. As an alternative to using setSelectionFrom(_:to:anchor:highlight:) for programmatically making discontiguous selections of cells in a matrix, you could first set the single selected cell and then set subsequent cells to be highlighted; afterwards you can access selectedCells to obtain the selection of cells.

## See Also

### Related Documentation

- [isHighlighted](appkit/nscell/ishighlighted.md)

### Finding Cells

- [selectedColumn](appkit/nsmatrix/selectedcolumn.md)
- [selectedRow](appkit/nsmatrix/selectedrow.md)
- [cell(atRow:column:)](appkit/nsmatrix/cell(atrow:column:).md)
- [cell(withTag:)](appkit/nsmatrix/cell(withtag:).md)
- [cells](appkit/nsmatrix/cells.md)
