How would you recreate Bindings at best. #266
-
| When migrating from SwiftData, you used something like this: TextEditor(text: $task.content)
  .font(.body)
  .foregroundStyle(.primary)
  .disabled(task.isCompleted())This would likely automatically update. However, how would you achieve something similar in SQLiteData? Would the best approach be to call the database update when, for example, the modal is closed? In this example, there’s no "save" button, so it should automatically update. Using a Binding(get: {}, set: {}) and updating on every change make sense? | 
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
| Our general recommendation is to copy editable records in local  
 These are just a few examples, but there are many more you could try. | 
Beta Was this translation helpful? Give feedback.
-
| Wow! Thank you, didn’t think of those! On unfocus is probably best for my needs. Great, thank you very much. 🙏 | 
Beta Was this translation helpful? Give feedback.
Our general recommendation is to copy editable records in local
@Statethat can be bound, and then update explicitly depending on your needs. You could do any one or more of the following:taskview modifier that debounces saves to the database based off the hash identity of the record:onDisappearto always save when the view goes away.These are just a few examples, but there are many more …