4 ms·
As with many problems this can be handled by a layer of indirection. Have your subclass push all its data into a storage object that itself is a simple ObjC ty
by xenadu02 2y ago
As with many problems this can be handled by a layer of indirection.
Have your subclass push all its data into a storage object that itself is a simple ObjC type held in a standard ARC-managed property/ivar. Then the NSCopyObject memcpy copies the pointer to your storage and the ARC fixup ensures the retain count of the storage object is correct.
This is the simplest way to resolve the problem for something like NSCell without anyone making future code changes needing to think about it too hard or accidentally introducing a regression.