NSViewController for each row in an NSTableView based view?

Cocoa's usual good practice dictates that each NSView should have its own NSViewController as its owner. Should this apply to every row of a View-Based NSTableView , and if so, what is a good strategy to initialize and cache these NSViewControllers?

+4
source share
1 answer

In most cases this would be redundant. Each NSView not need to have a controller. What about representations that are not related to the model layer - in this case, the mediator / controller would not be superfluous? In a large table, this will increase the number of controller objects that are likely to be unnecessary.

I would carefully consider the TableViewPlayground sample project available in the documentation. Note that in this project, Apple uses various views containing strings. In particular, focus on the ATComplexTableViewController class and its associated nib file. Here, the dataSource for the table view returns views for which the dataSource itself acts as an intermediary between the view and the model.

+2
source

Source: https://habr.com/ru/post/1436729/


All Articles