@dynamic just tells the compiler that the getter and setter methods are implemented not by the class itself but somewhere else (like the superclass or will be provided at runtime).
@class is used for creating forward declaration of any class. If you're creating any class that's implementation is unknown to you then you can do this using @class compiler directive. You can implement this class when the implementation is known to you.
@dynamic
means “my class will figure out how to respond to this at runtime.” Uses a runtime mechanism for an object to intercept messages it normally wouldn’t respond to. In the case where a Core Data db is used to store persistent data, NSManagedObject turns these into calls to -valueForKey:
and -setValueForKey:
.
Take a look at Lecture 12 (Fall 2010) of Stanford's iPhone development course.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With