frederik_diamond on Nostr: I got it working. Turns out the problem was with nested value types not triggering ...
I got it working.
Turns out the problem was with nested value types not triggering view updates.
Now I am working with folder IDs instead of passing around entire folder objects.
Before I was working with copies of the folder array, not the original. I am now creating a complete copy of the folders array and replacing it entirely when changes happen. So now SwiftUI knows when to update the UI.
It sure did take some time to fix. I’ll need to do some more testing to make sure it 100% works. But my solution seems very promising 🤞 #dev #swift
Turns out the problem was with nested value types not triggering view updates.
Now I am working with folder IDs instead of passing around entire folder objects.
Before I was working with copies of the folder array, not the original. I am now creating a complete copy of the folders array and replacing it entirely when changes happen. So now SwiftUI knows when to update the UI.
It sure did take some time to fix. I’ll need to do some more testing to make sure it 100% works. But my solution seems very promising 🤞 #dev #swift
quoting note1faq…620eI think I have screwed up with my state management in my Swift notes app.
I can’t get a view to update immediately. Every time a change happens, the user must go back and forth between views before the change is reflected in the UI.
Done some research, and it seems like my problem is a classic Swift problem known as “the nested Observable Objects issue”. #swift #dev