I'm trying to bridge my React-Native 0.33 code to a super simple Swift method, following this guide but all I'm getting is show:(NSString *)name is not a recognized Objective-C method
.
Here's my code:
SwitchManager.swift
import Foundation
@objc(SwitchManager)
class SwitchManager: NSObject {
@objc func show(name: String) -> Void {
NSLog("%@", name);
}
}
SwitchManagerBridge.h
#import "RCTBridgeModule.h"
@interface RCT_EXTERN_MODULE(SwitchManager, NSObject)
RCT_EXTERN_METHOD(show:(NSString *)name)
@end
SwitchManager-Bridging-Header.h
#import "RCTBridgeModule.h"
Then on my index.ios.js
file I'm importing SwitchManager with import { SwitchManager } from 'NativeModules';
and calling SwitchManager.show('One');
. This is where the error happened.
Not sure what's wrong.