Switch macOS DetailedList to view-based renderer
- Dominant language
- Python
- Stars
- 5.4k
- Forks
- 827
- Avg merge
- 9h 45m
- Merged PRs (30d)
- 58
Description
### 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](https://github.com/beeware/toga/blob/daeb319e28c7011b42174cfd2b3e2d910b492e74/cocoa/src/toga_cocoa/widgets/internal/cells.py#L31) and [here](https://github.com/beeware/toga/blob/daeb319e28c7011b42174cfd2b3e2d910b492e74/cocoa/src/toga_cocoa/widgets/table.py#L39) 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.
Contributor guide
Research direction
Start by reading cocoa/src/toga_cocoa/widgets/internal/cells.py and cocoa/src/toga_cocoa/widgets/table.py, especially how Toga's existing Table manages view-based NSTableView rendering. Apply that comparison to the TogaList DetailedList implementation, then verify that rows use view-based rendering and that the swipe-to-reveal row-actions API is called.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- macos, objective-c
- Domain
- desktop
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100