cfischer
cfischer

Reputation: 24912

@objc(ClassName) for subclasses of NSManagedObject

Is it necessary to add the @objc attribute to classes that extend NSManagedObject? As in:

@objc(Note)
class Note: NSManagedObject {

    @NSManaged var text: String
    @NSManaged var name: String
}

I've seen this in a few code samples, but with no explanation on why it is necessary and what it does...

Upvotes: 0

Views: 227

Answers (1)

zisoft
zisoft

Reputation: 23078

It was necessary on earlier (beta) versions of Xcode, I had a problem with that, see my question on SO: Swift Breakpoint in CoreData library and the solution I posted.

As of current versions of Xcode it seems to not be necessary any longer, so I removed the @objc from my code.

Upvotes: 1

Related Questions