Difference between convenience init and awakeFromInsert
A class can have multiple convenience initializers. What I want is to enforce setting values for the core data object for ALL objects that are created.
If I set this default value in one convenience initializer and later (like weeks) I might forget that I need to set this specific value there too, I end up having different initializing objects.
If I put the default value set in the awakeFromInsert. This will always be called once an object is created. No matter which initializer I use.
So I don’t have to copy this to multiple initializers. It is a way for me to make sure this is really set.
Optional String in Core Data
The checkbox for optional in the Schema editor referred to optional for the SQLite database. This is not optional in Swift. If I leave it optional for the database and add or remove this value later, schema changes/migration can be easier to handle.