MarioIannotta/SwizzleSwift

Can only swizzle functions with @objc keyword

Opened this issue · 0 comments

I tried to write a swizzle demo:

  • First, I defined a class which is called MyClass with some functions;
  • Then, I defined another class which is called MyClassHook. In this class with another set of functions;
  • I used functions of MyClassHook to swizzle MyClass.

BUT! The compiler says I must add @objc keyword at the functions of MyClass. But I don’t want to do that.

Is there a way that I can avoid this issue?