I am jus wondering what is mean by @dynamic in objective-c and how it works.any help please
@dynamic means that you will provide an implementation of those methods dynamically at run time.
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtDynamicResolution.html
has all the details, but basically using @dynamic means that you promise to provide implementations for the property promised methods at runtime.
In particular look here;
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html
for an example of how you'd construct your dynamic method and place it into the runtime.
Core Data uses this mechanism to provide the accessors. It's quite amazingly cool, once you dig into it :)
And as a side note, meta-programming in ObjC is not for the faint of heart, don't ship it till you grok it, otherwise your users will suffer.
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