0

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...

cfischer
  • 24,452
  • 37
  • 131
  • 214

1 Answers1

1

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.

Community
  • 1
  • 1
zisoft
  • 22,770
  • 10
  • 62
  • 73