I have a macOS app made with SwiftUI where I want to show a list of data in a tabular fashion. SwiftUI Table
seems to be the only built-in component that can do this.
I would like to let the user size the columns and have their widths restored when the app is relaunched. I can find no documentation on how to do this and it does not seem to be saved and restored automatically.
I can find no way to listen for changes in the column widths when the user resizes and no way to set the size from code.
For a macOS app it seems that the only way to set the width of a column is to use e.g. .width(min: 200, max: 200)
. This in effect disables resizing of the column. It seems that idealSize
is totally ignored on macOS.
Any suggestions?