Example using Core Data between views

I'm very frustrated with Core Data, the information varies so much and they are trying to adapt it to SwiftUI that everything is a mess on the documentation side. I created an app and the UI doesn't know when core data has a change also when I switch screens... the question is, how can I make sure that my app is aware of core data changes. Is there a simple CRUD app that I can see with the latest practices such as observable object and MVVM ? I bought a Udemy course and has data from the beta, on youtube there is nothing useful, everyone has something different with old data.

So how can I see a simple example to disect where they implement:

- observable object

- MVVM

- passsing data back and forth between different screens such as 2 TabViews


Thank you

Accepted Reply

hi,


Scala? not anything i have written. it looks like there are a gazillion things on github that come up by searching for shopping list, but only one is mine.


did you find mine correctly?

h ttps://github.com/delawaremathguy/ShoppingList


hope that helps,

DMG

Replies

hi


i'll offer an example ... on github, look for delawaremathguy/ShoppingList


i'll leave this public for a short time. it's a (very small) work in progress as i get more into the spirit of SwiftUI, but it has the features you are looking for: CoreData, multiple tabs, and the ability to edit on a second screen with edits reflected on the main screen.


comments welcome!


hope that helps,

DMG

Hi, I really appreciate the gesture. I went to github and that project is in Scala, not SwiftUI, did I go to the right one?

hi,


Scala? not anything i have written. it looks like there are a gazillion things on github that come up by searching for shopping list, but only one is mine.


did you find mine correctly?

h ttps://github.com/delawaremathguy/ShoppingList


hope that helps,

DMG

Thanks Jerry, I'll look at it today after lunch, hopefully I can learn how to propely use it. If it's a sensitive project you'd like to hide back you can do so, I downloaded it already. Thank you very much for the help

hi,


be sure to look in the Global.swift file, and set the kPerformInitialDataLoad variable to true when you do the first run (then, put it back to false). that will load data from the .json files included in the project.


this is far form a sensitive project, so enjoy. i think it has a lot of what you were asking for.


good luck,

DMG