Created
December 27, 2025 11:58
-
-
Save helje5/4836c1759a8bbe84ac914d2ded90aa3a to your computer and use it in GitHub Desktop.
One Column NSTableView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public extension ZzViewFactory { | |
| func makeOneColumnTableView(_ configure: ( UXTableView ) -> Void) -> UXView { | |
| return makeTableView { tv in | |
| #if os(macOS) | |
| tv.headerView = nil // no header view | |
| tv.allowsColumnResizing = false | |
| tv.allowsColumnSelection = false | |
| tv.allowsEmptySelection = true | |
| tv.allowsMultipleSelection = false | |
| let tcID = NSUserInterfaceItemIdentifier("result") | |
| let tc = NSTableColumn(identifier: tcID) | |
| tc.isEditable = false | |
| tc.resizingMask = .autoresizingMask | |
| tv.addTableColumn(tc) | |
| // seems to be necessary to make the column expand the whole width | |
| tv.sizeLastColumnToFit() | |
| #else | |
| tv.allowsMultipleSelection = false | |
| #endif | |
| configure(tv) | |
| } | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Related: