Skip to content

Switch macOS DetailedList to view-based renderer #4496

Description

@johnzhou721

What is the problem or limitation you are having?

In the (past) process of trying to solve #4416, it has been revealed that without using a "view-based" NSTableView, the API for swipe-to-reveal actions will simply not work (i.e., tableView:rowActions:forRow:edge: is not called at all, and thus the swipe-to-reveal actions implemented with that API will be ignored).

Toga at present uses cell-based NSTableView for DetailedList, using cell objects based on NSTextFieldCell set to the dataCell property. A view-based NSTableView consists of managing NSTableCellView objects properly by way of the tableView:viewForTableColumn:row: selector on an NSTableView.

Here and here in the code, we see that Toga's Table is already view-based.

Describe the solution you'd like

DetailedList (TogaList objective-C class) should be switched to use view-based rendering of rows, instead of cell-based rendering. This is the newer approach recommended Apple (see Additional Context), and is significantly easier to work with, avoiding any the likelihood of future instances of past issues such as #4264 and removing the need for custom-drawing.

Describe alternatives you've considered

Do nothing; for all functional purposes the current implementation works.

Additional context

The difference in cell-based and table-based NSTableViews is explained below. Cell-based NSTableViews are also deprecated.

https://stackoverflow.com/questions/31323234/view-and-cell-based-nstableview

Blocks #4416.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew features, or improvements to existing features.

    Projects

    Status
    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions