diff --git a/Sources/ReactBridgeMacros/ReactMethod.swift b/Sources/ReactBridgeMacros/ReactMethod.swift index 96cc26c..4ebf0b1 100644 --- a/Sources/ReactBridgeMacros/ReactMethod.swift +++ b/Sources/ReactBridgeMacros/ReactMethod.swift @@ -37,9 +37,9 @@ extension ReactMethod: PeerMacro { """ @objc static func __rct_export__\(raw: funcName)() -> UnsafePointer? { struct Static { - static let jsName = NSString(string: \(raw: jsName)) - static let objcName = NSString(string: "\(raw: objcName)") - static var methodInfo = RCTMethodInfo(jsName: jsName.utf8String, objcName: objcName.utf8String, isSync: \(raw: isSync)) + static let jsName = strdup(\(raw: jsName)) + static let objcName = strdup("\(raw: objcName)") + static var methodInfo = RCTMethodInfo(jsName: jsName, objcName: objcName, isSync: \(raw: isSync)) } return withUnsafePointer(to: &Static.methodInfo) { $0 } } diff --git a/Tests/ReactBridgeTests/ReactBridgeTests.swift b/Tests/ReactBridgeTests/ReactBridgeTests.swift index 6b1f969..075d11b 100644 --- a/Tests/ReactBridgeTests/ReactBridgeTests.swift +++ b/Tests/ReactBridgeTests/ReactBridgeTests.swift @@ -14,9 +14,9 @@ final class ReactMethodTests: XCTestCase { """ @objc static func __rct_export__\(name)() -> UnsafePointer? { struct Static { - static let jsName = NSString(string: "\(jsName ?? name)") - static let objcName = NSString(string: "\(selector)") - static var methodInfo = RCTMethodInfo(jsName: jsName.utf8String, objcName: objcName.utf8String, isSync: \(isSync)) + static let jsName = strdup("\(jsName ?? name)") + static let objcName = strdup("\(selector)") + static var methodInfo = RCTMethodInfo(jsName: jsName, objcName: objcName, isSync: \(isSync)) } return withUnsafePointer(to: &Static.methodInfo) { $0