Learnings from "Unleash Core Data" part 1 #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here's a big takeaway I had from Avi Tsadok's "Unleash Core Data":
We can actually remove all the "Entity+CoreDataProperties.swift" generated code files in an app by using Category/Extension option for code generation in the data model gui tool. Nice!! That was always a big frustration for me, so I love reducing the duplication to just one source of truth.
If you use Manual/None option on code generation, like I always have, you are required to have
+CoreDataProperties.swiftfiles, which are generated manually by the developer in Xcode and are redundant and always have to kept in sync with the data model itself when making any changes. You would always have to remember to make any change to the an entity's properties twice:Entity+CoreDataProperties.swiftfileNo more! I'm adopting Tsadok's suggestion and using Category/Extension option instead, and deleting the properties files, which will instead be generated at compile time by Xcode in derived data. This effectively automates some work I was doing manually previously.
Doing this also fixed a couple types in the example app! so as a result I'm also changing the framework utils that the example app uses a bit to match the different types (supporting optionals for the CD String properties created in the gui)
Also taking the opportunity to polish example app and readme a little