I get a response, add a "dynamic" keyword before the method name !!!
eg:
dynamic func function1()
{
print("function1 log")
}
dynamic func function2()
{
print("function2 log")
}
Reason:
Swift optimizes the code for calling direct memory addresses instead of finding the location of the method at runtime, as in Objective-C. so we need to say that running the code sees it as Objective-C code.
:
swizzling - , . swizzling, . Swift , Objective-C. swizzling Swift, :
1. . , , , Swift.
2. NSObject. swizzling ( ). , swizzling , NSObject , .
3. @objc swizzled. , , , Objective-C .
: 15 ,