|
Hi Everyone, I have a environment object that is saved to coredata. How can I update new user entered values to the same core data Entity? |
|
Ok, considering your DataController is in place and you can succesfully demonstrate the results of your CoreData using somewhere in your ContentView (let's assume ContentView) a ForEach..using the example of the Dice App you could have the below Your Entity Your example results calling in the ContentView
Your ForEach
using as an example a .onTapGesture you could modify each istance(result) of the Dice like this
The above is the main idea, you can play around as needed :) I hope it makes some sense.. |
|
Hi, thank you for your reply. However, I am still having some trouble with my code: I have a NavigationView{ Create a new project > takes to a project details page List { saved projects from coredata - that I would like to edit -> takes to a projects details page } } Essentially, I would like the project details values to populate from coredata but no luck. I have a feeling it may be due to my DataController.swift
|
|
Your DataController looks fine to me. I guess you have a detailedView somewhere, how do you try to pass from the ContentView to your DetailView? |
|
As you can see, under the List{ ForEach...} I have to inject an environment object. How can I load that specific savedProject from coredata?
|
|
I am not sure I know how to do it with injecting the fetchedRequest result, but a way that would work with your code is that if you modify your EditProjectView to receive a Project (Where Project I guess is your CoreData entity). Then your NavigationLink will be:
|
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.