I am relatively new to iOS programming and I am having a hard time making peace between how CoreData works and what I know about software architecture.
So I am trying to setup a project around the MVVM pattern with Combine framework and SwfitUI.
My first problem is the
The other problem is when you need to load just some of the columns out of your database table, with CoreData that means that not only you'll be arranging a rather complex database fetch operation inside your view, you'll get a dictionary result at the end, which means a whole lot of string literals for keys and type castings for values in your view code.
I would normally just inject a repository into my view-model and, if required, I would return a light version of my entity from the repository with only the required columns on it.
And finally, I find it problematic that all entities are
Using that approach and mapping CoreData entities to immutable entities in each repository, I was able to address all the above concerns. As it stands now, I have, for instance, a
At this point, I am starting to doubt whether it is worth all the effort and the overhead that CoreData brings with it, just to keep using CoreData. Why not just ditch CoreData altogether and use something like Realm instead? That looks like a bold move though, considering how integral CoreData is to iOS programming. So I wanted to know the opinion of more experienced iOS programmers.
I know CoreData is a big frameworks and I am standing to lose some of its features here (like storage in iCloud which I don't need and batch loading which I could live without), but apart from those, would you call it a terribly bad idea to ditch CoreData for the reasons that I presented above.
i've been going back and forth on several architecture ideas when Core Data is involved in a simple (well, it was intended to be simple) project called ShoppingList15. it has a simple Core Data graph: an
this project currently has 3 branches to it:
the underlying problem in all of this: bridging the gap between Core Data (object-focused) and SwiftUI (struct-focused).
i am hopeful there will be some discussion on this thread. i am no expert ... i just try things out in public and hope for some useful feedback.
hope that helps,
Core data work and software architechure have a great relation which I understand when I was developing an iOS app for Dear Lottery Result Today 1pm. Although you will also learn it with experience. But here I would like to give you an advice. Whenever you see any issue so try to search about that issue on youtube and you will get solution.
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.
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.