|
In a Document app for MacOS using latests non-beta tools. This works:
But this column version does not:
The error is about the .payee keyPath "Key path value type 'String?' cannot be converted to contextual type 'String'" payee is an optional property of the @Model class TheTransaction. The class has an init and also code to make it codeable (for JSON import). If the model is in a standard struct there is no problem and both work, although the former is not not sortable. The goal is to list all the transactions in a Table, sortable by any column. Straighforward when not using SwiftData. Anyone have an example of presenting SwiftData in a Table and eligible for sorting? |
|
Hi, You could add a computed property to your
|
|
Yes that does compile, but isn't it just the same as making the var non-optional (which also works). |
|
Sorry i misunderstood your question; The only way i've been able to display and sort a
|
|
Updated the code inside the |
SPONSORED Get accurate app localizations in minutes using AI. Choose your languages & receive translations for 40+ markets!
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.