Swizzling a single instance, not a class

前端 未结 3 2002
我寻月下人不归
我寻月下人不归 2021-02-04 04:05

I have a category on NSObject which supposed to so some stuff. When I call it on an object, I would like to override its dealloc method to do some cleanups.

I wanted to

3条回答
  •  萌比男神i
    2021-02-04 04:37

    I made a swizzling API that also features instance specific swizzling. I think this is exactly what you're looking for: https://github.com/JonasGessner/JGMethodSwizzler

    It works by creating a dynamic subclass for the specific instance that you're swizzling at runtime.

提交回复
热议问题