Design question: tableView or not tableView ?

That's an OS X project (I use Swift, but doesn't matter here).


I want to display a grid in a view, with the following characteristics, that looks and feel a bit like a spreadsheet (but not any spreadsheet functionality)

- the first column will get some text labels

- the first row will get other labels, written vertically

the table itself (ie, excepting header coluim and row)

- each cell should be a square, small size, which can have a short text as a number, and may be fully colored

- each cell can be modified (such as switched on / off) by clicking on it

- The number of columns will change dynamically (the same for rows of course)

- finally, I would need to show the grid lines between cells.


the table content will have to scroll both horizontally and vertically, but headers should not move


Wth all these constraints (and a few others), I hesitate between several design options:

- use plain tableView (probably view based)

- subclass tableView (as Apple tells : "Subclassing NSTableView is usually not necessary. Instead, you customize the table view using a delegate object, or by subclassing one of the following subcomponents: cells (when using NSCell-based table views), the row cell view or the row view (when using NSView-based table views), the table column class, or table column header classes.") : I would appreciate to see some example before going on

- do it manually (draw the content and manage the scroll, the user interaction…)


I'll appreciate any experienced advice

From `NSCollectionView`:


An NSCollectionView object displays a grid of views.


You should check out this class. It can easily do what you're talking about, and is beyond customizable once you get the hang of it, allowing you to build quickly an easily a spreadsheet style view that can be (near) infinitely expandable.


NSTableView will be a little bit more challenging but theoretically feasible since it does support multiple columns as well.

Design question: tableView or not tableView ?
 
 
Q