When you will get this error?
It’s a very common error who just started using Core Data in their iOS development journey. It comes when you create an instance of the Core Data class. e.g.
var items = Item() //Here Item is a Core Data class.
Reason for this error
In Core Data, Creating a direct instance of the Class is not allowed. We must use the designated initializer. e.g.
Item(entity: NSEntityDescription, insertInto: NSManagedObjectContext?)
Solution for this error
Don’t create a direct instance of the Core Data Class.
1) Create an instance using the designated initializer
2) Create an Optional type, if you are not using the object right away.