Skip to content

Commit 030546f

Browse files
committed
Registering modules changes
1 parent 27c4d10 commit 030546f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Sources/ReactBridgeUtils/ReactBridgeUtils.m

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ static void class_performClassSelector(Class class, SEL selector) {
4242
let methods = class_copyMethodList(object_getClass(class), &count);
4343

4444
for (var i = 0; i < count; i++) {
45-
let method = methods[i];
46-
let methodName = method_getName(method);
47-
if (sel_isEqual(methodName, selector)) {
45+
Method method = methods[i];
46+
let methodSelector = method_getName(method);
47+
if (sel_isEqual(methodSelector, selector)) {
4848
let imp = method_getImplementation(method);
4949
((void (*)(Class, SEL))imp)(class, selector);
5050
break;
@@ -58,17 +58,15 @@ static void class_performClassSelector(Class class, SEL selector) {
5858
static void load() {
5959
let selector = @selector(_registerModule);
6060

61-
let processName = [NSProcessInfo.processInfo.processName cStringUsingEncoding: NSUTF8StringEncoding];
62-
let processNameLength = strlen(processName);
63-
6461
var count = objc_getClassList(NULL, 0);
6562
let classes = (Class *)malloc(sizeof(Class) * count);
6663
count = objc_getClassList(classes, count);
6764

6865
dispatch_apply(count, DISPATCH_APPLY_AUTO, ^(size_t index) {
6966
Class class = classes[index];
7067
let className = class_getName(class);
71-
if (strncmp(processName, className, processNameLength) == 0) {
68+
// Check only swift classes
69+
if (strstr(className, ".")) {
7270
class_performClassSelector(class, selector);
7371
}
7472
});

0 commit comments

Comments
 (0)