Hello everyone I have been studying SwiftUI for 1 month and ran into a problem. TextField does not work correctly, namely it is difficult to print text on the simulator. When you quickly type 5 characters, it displays only 1. When you try to finish a word at the beginning, the cursor jumps to the end. And when I tested it on my own device, the application was closed altogether. I think it's because of incorrect data saving. Please tell me how to fix this problem and whether I am saving the data correctly.
About the app: I am creating this app for myself. This is a collection of tasks solved by me (something like notes). You can see the code below.
Hi @alextim123, I think you're using wrongly the binding, I mean, a binding usually is injected directly from a view that owns a state to another view for the next purpose, when you change something in one view, then the other needs the data updated.
In that case, your Problem Store is the object which owns the real data, and it is not being retained by anyone (as far as I can see).
So the suggestion is to use an @StateObject var problemStore in the first view, pass a binding to the second one, or use an @StateObject in the first and @ObservedObject in the second one. By Doing this, you avoid the redraw of the view and remove your data on the text field because the data is stored in the logic class.