You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
then grab the undo manager from @Environment(\.undoManager)
then call undoManager.undo()
But, right now, we are creating our ModelContainer manually in our Dependency client and none of the initializers for ModelContainer, ModelConfiguration, nor ModelContext have a isUndoEnabled param.
Perhaps, we can just create our own UndoManager and attach it to our context, but I've tried that in various ways and have yet to get it working.
Observability:
Currently, we're calling send(.onAppear) to refresh our data, any time that we ask SwiftData to make a change. But the problem is 1) we have to remember to always call send(.onAppear), and 2) If something else modifies SwiftData (e.g. a sync from CloudKit) then we are unaware and we now have stale data.
If we were using vanilla @Query it would handle this for us. I discovered a way to incorporate an @Query into TCA. Here's a PR. I'm still learning the pros/cons of this approach.
Also, in a few weeks pointfree.co will release their solution for implementing Observable into TCA. So hopefully that should solve observability.
The text was updated successfully, but these errors were encountered:
I'm not sure if you're interested, but I would like to get a proof of concept made for implementing SwiftData's undo/redo functionality in TCA.
I've explored it some so far but it is not easy. Two major problems I've found so far:
isUndoEnabled: true
into modelContainer(for:inMemory:isAutosaveEnabled:isUndoEnabled:onSetup:)@Environment(\.undoManager)
isUndoEnabled
param.send(.onAppear)
to refresh our data, any time that we ask SwiftData to make a change. But the problem is 1) we have to remember to always callsend(.onAppear)
, and 2) If something else modifies SwiftData (e.g. a sync from CloudKit) then we are unaware and we now have stale data.@Query
it would handle this for us. I discovered a way to incorporate an@Query
into TCA. Here's a PR. I'm still learning the pros/cons of this approach.The text was updated successfully, but these errors were encountered: