|
Hi, I am looking for a best practice to edit data which is stored with CoreData. Given a Model:
The data which is stored in the model is display in a list view:
Please appologize the miss-named isFoodDetailViewPresented. This points to AddFoodView, which is basically the same. However I found no proper way to use just one view for adding and both editing food. The FoodDetailView which is used for editing is found below, but crashed when I try to save at the moment. I just do not know what to pass and how to initialize the form:
I guess that I missunderstood parts of the concept. What would be a better solution. By the way: Binding of $food.amountunit and $food.amount does not work either as expected |
|
hi, i think we will need more code, so i'll only suggest some things for you to consider.
hope that gets you started, DMG |
|
Thanks @delawaremathguy. Passing the model explicitely fixed it. Unfortunately I stepped into the next problem, for which I opened a new thread: https://www.hackingwithswift.com/forums/swiftui/initializing-an-edit-form/8745 |
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.