I have encountered this keyword in various occasions. I kind of know what it's suppose to do. But I really want a better understanding of it.
What I noticed about
Core Data provides the underlying storage and implementation of properties in subclasses of the NSManagedObject class. Add the @NSManaged attribute before each property definition in your managed object subclass that corresponds to an attribute or relationship in your Core Data model. Like the @dynamic attribute in Objective-C, the @NSManaged attribute informs the Swift compiler that the storage and implementation of a property will be provided at runtime. However, unlike @dynamic, the @NSManaged attribute is available only for Core Data support.
Variables withshall be exempt from compile time checks for something.
Key Value Coding
let score = results.objectForKey("descriptionOfResult")
//returns the descriptionOfResult value from the results object
results.setObject("The results for a physics exam", forKey: "descriptionOfResult")
//sets the value of descriptionOfResult
Yes, it kinda really acts like @dynamic -- technically it might be identical even. Semantically there is a slight difference:
@dynamic says 'compiler, don't check if my properties are also implemented. There might be no code you can see but I guarantee it will work at runtime'
@NSManaged now says 'compiler, don't check those properties as I have Core Data to take care of the implementation - it will be there at runtime'
so you could even say: @NSManaged is syntactic sugar that is a more narrow version of dynamic :)
here someone even used @NSManaged without CD because he wanted the @dynamic behaviour