---
title: "init(frame:mode:prototype:numberOfRows:numberOfColumns:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nsmatrix/init(frame:mode:prototype:numberofrows:numberofcolumns:)"
---

# init(frame:mode:prototype:numberOfRows:numberOfColumns:)

Initializes and returns a newly allocated matrix of the specified size using the given cell as a prototype.

## Declaration

```swift
init(frame frameRect: NSRect, mode: NSMatrix.Mode, prototype cell: NSCell, numberOfRows rowsHigh: Int, numberOfColumns colsWide: Int)
```

## Parameters

- `frameRect`: The matrix’s frame.
- `mode`: The tracking mode for the matrix; this can be one of the modes described in doc://com.apple.appkit/documentation/AppKit/NSMatrix/Mode-swift.enum.
- `cell`: An instance of a subclass of doc://com.apple.appkit/documentation/AppKit/NSCell, which the new matrix copies when it creates new cells.
- `rowsHigh`: The number of rows in the matrix.
- `colsWide`: The number of columns in the matrix.

## Discussion

Discussion This method is the designated initializer for matrices that add cells by copying an instance of an NSCell subclass.

## See Also

### Initializing an NSMatrix Object

- [init(frame:)](appkit/nsmatrix/init(frame:).md)
- [init(frame:mode:cellClass:numberOfRows:numberOfColumns:)](appkit/nsmatrix/init(frame:mode:cellclass:numberofrows:numberofcolumns:).md)
