3 ms·
You can do so in most languages as long as they're dynamically typed or have a reflection API, and Objective-C is dynamically typed. But in this case private m
by masklinn 11y ago
You can do so in most languages as long as they're dynamically typed or have a reflection API, and Objective-C is dynamically typed.
But in this case private methods aren't exactly involved, the code traverses the views (widgets) hierarchy (which is necessarily public) until it finds an object of a specific class (which comes from a private framework), then it replaces one of the methods to get the behaviour it wants (it actually replaces the class of the object with a subclass overriding that specific method, something many if not most dynamically typed languages allow for, which is way overkill, usually you'd just swap the method — that's called "swizzling" in the objective-c world)