Reputation: 1014
Since Xcode 8 provides a seemingly great possibility to skip the generation of the NSManagedObject subclasses code and does it itself I wanted to use it in my app. However, I also wanted to use some transient properties for the sake of grouping the objects while using the NSFetchedResultsController. Is this possible to somehow achieve or do I have to traditionally generate the classes and write these properties' implementation by myself?
Upvotes: 1
Views: 253
Reputation: 5888
There's no need to subclass it, try mark your property as transient
Then you will be automatically able to access this property.
func insertNewObject(_ sender: Any) {
let context = self.fetchedResultsController.managedObjectContext
let newEvent = Event(context: context)
// If appropriate, configure the new managed object.
newEvent.timestamp = NSDate()
newEvent.someT = "ABC"
Upvotes: 0
Reputation: 2593
I do not think this is possible without generating the NSManagedObject
subclasses.
This is likely what the "Category/Extension"
codegen option helps to address. This codegen option is useful for creating properties (attributes) that you do want Core Data to manage.
Upvotes: 1