Wednesday, October 12, 2022

Subclassing for Debugging

Paul Samuels:

A really useful trick when debugging is to subclass the thing you are interested in just to make it easier to search for inside the various debugging tools.

[…]

There are plenty more places like instruments, logging etc to make use of this technique.

It can also be useful to subclass to override -retain and -release so you can easily see when they are being called. However, this is only possible if your class inherits from an Objective-C class that you control.

1 Comment RSS · Twitter


I have a feeling you can still ISA swizzle even a Swift object, and override its retain and release methods on Apple platforms.

Leave a Comment