You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I swizzle the method in right way. After swizzle, I print origA() and origB(), I expected them to be myA() and myB(), but the console still print origA() and origB().
I run in debug mode and found that, in SwizzleSwift.swift, public struct Swizzle, there’ s a code;
guard
let original =class_getInstanceMethod(type,SwizzlePair.original),let swizzled =class_getInstanceMethod(type,SwizzlePair.swizzled)else{return}
And this code always execute the else block, which means that original or swizzled is returning nil.
Why? Is there a problem in my code?
The text was updated successfully, but these errors were encountered:
I wrote the code:
I swizzle the method in right way. After swizzle, I print
origA()
andorigB()
, I expected them to bemyA()
andmyB()
, but the console still printorigA()
andorigB()
.I run in debug mode and found that, in
SwizzleSwift.swift
,public struct Swizzle
, there’ s a code;And this code always execute the
else
block, which means thatoriginal
orswizzled
is returning nil.Why? Is there a problem in my code?
The text was updated successfully, but these errors were encountered: