File tree Expand file tree Collapse file tree 5 files changed +14
-26
lines changed
Expand file tree Collapse file tree 5 files changed +14
-26
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,10 @@ let package = Package(
1717 ) ,
1818 ] ,
1919 targets: [
20- . target( name: " SuperBuilder " ) ,
20+ . target( name: " ITKSuperBuilder " ) ,
2121 . target(
2222 name: " InterposeKit " ,
23- dependencies: [ " SuperBuilder " ]
23+ dependencies: [ " ITKSuperBuilder " ]
2424 ) ,
2525 . testTarget(
2626 name: " InterposeKitTests " ,
Original file line number Diff line number Diff line change @@ -44,11 +44,13 @@ There are a few important details:
4444
4545@see https://steipete.com/posts/calling-super-at-runtime/
4646*/
47- @interface SuperBuilder : NSObject
47+ @interface ITKSuperBuilder : NSObject
4848
4949// / Adds an empty super implementation instance method to originalClass.
5050// / If a method already exists, this will return NO and a descriptive error message.
51- + (BOOL )addSuperInstanceMethodToClass : (Class )originalClass selector : (SEL )selector error : (NSError **)error ;
51+ + (BOOL )addSuperInstanceMethodToClass : (Class )originalClass
52+ selector : (SEL )selector
53+ error : (NSError **)error ;
5254
5355// / Check if the instance method in `originalClass` is a super trampoline.
5456+ (BOOL )isSuperTrampolineForClass : (Class )originalClass selector : (SEL )selector ;
@@ -63,9 +65,9 @@ There are a few important details:
6365
6466@end
6567
66- NSString *const SuperBuilderErrorDomain ;
68+ NSString *const ITKSuperBuilderErrorDomain ;
6769
68- typedef NS_ERROR_ENUM (SuperBuilderErrorDomain, SuperBuilderErrorCode ) {
70+ typedef NS_ERROR_ENUM (ITKSuperBuilderErrorDomain, ITKSuperBuilderErrorCode ) {
6971 SuperBuilderErrorCodeArchitectureNotSupported,
7072 SuperBuilderErrorCodeNoSuperClass,
7173 SuperBuilderErrorCodeNoDynamicallyDispatchedMethodAvailable,
Original file line number Diff line number Diff line change 66
77NS_ASSUME_NONNULL_BEGIN
88
9- NSString *const SuperBuilderErrorDomain = @" com.steipete.superbuilder " ;
9+ NSString *const ITKSuperBuilderErrorDomain = @" com.steipete.InterposeKit " ;
1010
1111void msgSendSuperTrampoline (void );
1212void msgSendSuperStretTrampoline (void );
@@ -37,9 +37,9 @@ static IMP ITKGetTrampolineForTypeEncoding(__unused const char *typeEncoding) {
3737}
3838
3939#define ERROR_AND_RETURN (CODE, STRING )\
40- if (error) { *error = [NSError errorWithDomain: SuperBuilderErrorDomain code: CODE userInfo: @{NSLocalizedDescriptionKey : STRING}];} return NO ;
40+ if (error) { *error = [NSError errorWithDomain: ITKSuperBuilderErrorDomain code: CODE userInfo: @{NSLocalizedDescriptionKey : STRING}];} return NO ;
4141
42- @implementation SuperBuilder
42+ @implementation ITKSuperBuilder
4343
4444+ (BOOL )isSupportedArchitecture {
4545#if defined (__arm64__) || defined (__x86_64__)
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11import Foundation
2- import SuperBuilder
2+ import ITKSuperBuilder
33
44class InterposeSubclass {
55
@@ -86,12 +86,12 @@ class InterposeSubclass {
8686 }
8787
8888 class var supportsSuperTrampolines : Bool {
89- NSClassFromString ( " SuperBuilder " ) ? . value ( forKey : " isSupportedArchitecture " ) as? Bool ?? false
89+ ITKSuperBuilder . isSupportedArchitecture
9090 }
9191
9292 func addSuperTrampoline( selector: Selector ) {
9393 do {
94- try SuperBuilder . addSuperInstanceMethod ( to: dynamicClass, selector: selector)
94+ try ITKSuperBuilder . addSuperInstanceMethod ( to: dynamicClass, selector: selector)
9595
9696 let imp = class_getMethodImplementation ( dynamicClass, selector) !
9797 Interpose . log ( " Added super for -[ \( dynamicClass) . \( selector) ]: \( imp) " )
You can’t perform that action at this time.
0 commit comments