Gaurav Gupta Gaurav Gupta - 1 year ago 48
Swift Question

call objective c method define in .m file used in swift file

My Problem is i m using objective c class in swift using bridge header.h.Firstly i am using swift file in objective c class to using this "#import Project-Swift.h". So by this i am using swift file in objective c. But By using this i m only using the method only .m file I am calling the function define in objective c class .m file & used in swift class. Because in my method i am using NSObject class as pass parameter. so this method are define in .h file to calling it so its show error "Excepted a type". how to resolve this issue. how to call the function without define in .h file. In this code Details is my NSObject Swift class. so these class using in .h so its show error.

#import <Foundation/Foundation.h>
#import <sqlite3.h>

@interface DBManager : NSObject
{
NSString *databasePath;
}
+(DBManager*)getSharedInstance;
-(BOOL)createDB;
-(BOOL)saveuserData:(Details *)userdetails;
@end

Answer Source

You should try this:

-(BOOL)saveuserData:(NSObject *)userdetails;