Post

Replies

Boosts

Views

Activity

Reply to SwiftData preview sample code
Thanks for the help fixing the preview, however I'm hitting issues when running the app in the simulator. Maybe something isn't setup right for working with the backend? Getting these errors when trying to create a new file in the running app: os_unix.c:46973: (0) open(/Users/myUserName/Library/Developer/CoreSimulator/Devices/17277B7F-0589-4D47-B3BF-C4C910FC23D6/data/Containers/Data/Application/C4A2EDA5-4BD0-4D9C-8437-75DFEC2B269F/Library/Application Support/default.store) - Undefined error: 0 API call with unopened database connection pointer misuse at line 179760 of [554764a6e7]
Jun ’23
Reply to Are enums with associated values supported by swiftdata in any real way?
I found a workaround for this that is similar to other workarounds for enums where you store the data in a private property and have a computed property that gets and sets it using the type you really wanted to use. My stored property is a string and my computed property encodes and decodes to and from json. I assume this is essentially what SwiftData itself will do when they finally add support for enums with associated values.
Aug ’23