Post

Replies

Boosts

Views

Activity

How to wire SwiftData up to external data sources?
In one of the WWDC 2023 videos a presenter said in passing that you can connect SwiftData to whatever complicated setup you have. I haven't been able to find any documentation or connection points for this though. Obviously I can fetch the data myself and call context.insert(...) for every item, but what about refreshes, deletes, inserts, updates? Where can I wire up these external calls and their responses? Thanks!
1
1
995
Jul ’23
SwiftData with inMemory storage promptly crashes with nw_socket_handle_socket_event
When my code tries to access a SwiftData model's relationship, my app promptly crashes with nw_socket_handle_socket_event [C1.1.1:2] Socket SO_ERROR 61 and no useful information. How do I go about debugging this? I'm creating my modelContainer as inMemory, so I don't think this should be touching any SQLite DB: @main struct MyApp: App { var body: some Scene { WindowGroup { ContentView() } .modelContainer( for: SchemaV1.models, inMemory: true, isAutosaveEnabled: false, isUndoEnabled: false) } }
1
0
505
Oct ’23