Reputation: 5079
I've recently reread the interesting tutorial from Mike Ash about How to create classes at Objective-C Runtime
I has been a long time I am wondering where to apply this powerful feature of the language. I always see an overkill solution to most of the ideas that come to my mind, and I eventually proceed with NSDictionary
. What are your cases of use of creating classes at runtime? The only one I see is an Obj-C interpreter... More ideas?
Upvotes: 1
Views: 1457
Reputation: 41821
KVO, in the Cocoa frameworks, is implemented by dynamically creating "notifying" versions of your classes. See http://www.mikeash.com/pyblog/friday-qa-2009-01-23.html
Upvotes: 0
Reputation: 6084
There's some possible options I see, when someone need to create class in runtime
In general.. There is some possible usages of this. But in real world, in default service applications there's no need to do this, actually:)
Upvotes: 6
Reputation: 4361
It could be used for example along Core Data or any API related to a database to create new classes of objects unknown at compilation time. However, I doubt this is used often, it's mostly the mechanism the system uses itself when it runs a program...
Upvotes: 0