ios - Calling swift function from objective c gives linker error -
i trying call swift function objective c file.
swift function implementation:
@objc class fxformvariables : nsobject { class func fxfontname() -> string { return fontname } class func fxfontsize() -> cgfloat { return fontsizelarge } class func fxhiddencell() -> nsarray { return hiddenelementfromformindex nsarray } }
objective c:
nsarray *hidearray = [fxformvariables fxhiddencell]; if ([hidearray containsobject:@(cellindexpath)]){ return 0.0; }
linker error in buildtime:
undefined symbols architecture x86_64: "_objc_class_$__ttcc13social_engine11appdelegate15fxformvariables", referenced from: objc-class-ref in fxforms.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation)
this code works fine in xcode 7.3 after upgrade 8.3 start throwing linker error.
please help. in advance.
import file named project name appending -swift.h in objective-c file
please check below example of import file
#import “projectname-swift.h”
xcode generate file when build project .swift files.
also, can check below question: how import swift code objective-c
Comments
Post a Comment