While reading the Objective-C Runtime Guide, I came across the following statements:
In the legacy runtime, if you change the layout of instance variables in a class, you must recompile classes that inherit from it.
In the modern runtime, if you change the layout of instance variables in a class, you do not have to recompile classes that inherit from it.
Can someone provide an example for this?
Sure. If Apple were to ship an AppKit.framework where
NSViewcontained a new instance variable, every single 3rd party library, framework, or application that contained a subclass — direct or indirect — ofNSView(that also had instance variables in that subclass) would have to be recompiled or else the app would no longer work.In the modern runtime, that is no longer true. Apple can ship a new implementation of NSView with additional instance variables and not break subclassers.
Or, as Greg Parker says, “it is all about not killing kittens.”.