I'm porting swift class to ReactNative.
my CalendarManager.Swift class
CalendarManager.Swift
import Foundation;
import UIKit;
// CalendarManager.swift
@objc(CalendarManager)
class CalendarManager: NSObject {
@objc
func addEvent(_name: String, location: String, date: NSNumber) -> Void {
// Date is ready to use!
NSLog("%@ %@ %S", _name, location, date);
// self.window?.rootViewController?.presentViewController(alert, animated: true, completion: nil)
}
}
my objective C class
CalendarManager.m
#import <Foundation/Foundation.h>
#import <React/RCTBridgeModule.h>
@interface RCT_EXTERN_MODULE(CalendarManager , NSObject)
RCT_EXTERN_METHOD(addEvent: (NSString *)name location:(NSString *)location date:(NSNumber *)date)
@end
SwiftBridge-header
#import <React/RCTBridgeModule.h>
Please let me know how to reduce that following error.
Try to Provide a method description for Objective-C.
Your fn:
Try changing it to:
where, ':' represents a parameter, since the function is receiving 3, so there would be 3 colons or you can pass variable names as well, though it won't matter.