update
This commit is contained in:
20
Pods/CocoaDebug/Sources/Swizzling/_Swizzling.m
generated
Executable file
20
Pods/CocoaDebug/Sources/Swizzling/_Swizzling.m
generated
Executable file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Example
|
||||
// man
|
||||
//
|
||||
// Created by man 11/11/2018.
|
||||
// Copyright © 2020 man. All rights reserved.
|
||||
//
|
||||
|
||||
#import "_Swizzling.h"
|
||||
|
||||
IMP replaceMethod(SEL selector, IMP newImpl, Class affectedClass, BOOL isClassMethod) {
|
||||
Method origMethod = isClassMethod ? class_getClassMethod(affectedClass, selector) : class_getInstanceMethod(affectedClass, selector);
|
||||
IMP origImpl = method_getImplementation(origMethod);
|
||||
|
||||
if (!class_addMethod(isClassMethod ? object_getClass(affectedClass) : affectedClass, selector, newImpl, method_getTypeEncoding(origMethod))) {
|
||||
method_setImplementation(origMethod, newImpl);
|
||||
}
|
||||
|
||||
return origImpl;
|
||||
}
|
||||
Reference in New Issue
Block a user