I'm still in the process of learning Swift, but I have a pretty good understanding of the basics and how it interacts with Objective-C. On my team, we have an Objective-C app and we're experimenting with some Swift in the app. Our standard in the past has been to put our constants in a header file like:
static NSString *const kSomeConstant = @"ConstantValue";
But when I reference this value in Swift, I get a linker error:
Undefined symbols for architecture x86_64:
"_kSomeConstant", referenced from: __TFFC22Commons_Tests36DCTestBTBusinessService25testSuccessfulFetchOffersFS0_FT_T_u0_KT_PSs11BooleanType_ in DCTestBTBusinessService.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
If I change the static const to a #define it compiles successfully but this is not ideal if not necessary. Any idea why this is not linking? Thanks for any help!
Edit: Here is an example of where we are trying to use the value. The CacheManager class is an Objective-C class and containsObjectForKey accepts an NSString as a parameter.
CacheManager.instance().containsObjectForKey(kSomeConstant)