I am trying to dynamic create objc class at runtime and I need to add some Ivar
to the created class. I found class_addIvar
which should do what I want, but I also found these functions:
class_setIvarLayout
class_getIvarLayout
class_getWeakIvarLayout
class_setWeakIvarLayout
the doc did not really said any useful information about these methods and I can't find out any useful explanation from web. So what are they? Do I need to use them if I want to do something with Ivar
?
The class_*IvarLayout
methods are used by the garbage collector (if/when you're using it) to determine which areas of an object's memory need to be scanned for strong/weak references.
It's unlikely you'll ever need to call these methods; the appropriate layouts are generated when you call objc_registerClassPair
.
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