I was watching this tutorial to use Core Data in Xcode 8 and the video was using Swift. In the video, He entered an entity named Task
in the Core Data model and then in the code he was able to call Task
like:
let task = Task(context: context)
I have an entity called Tag
. How can I access Tag in code using Objective-C? Codegen is set in the Core Data model but I don't see any additional files in my project. If I try:
Tag test = [[Tag alloc] init];
I get an error that Tag
does not exist.
Select the entity 'Tag' in model editor.
Generate source code for Task by selecting menu tree 'Editor' -> 'Create NSManagedObject Subclass...' then follow the instruction.
files will be created and automatically will be attached to your project.
Import header file.
Then create 'Tag' class.