Since the update to Xcode 7.3 with Swift 2.2 I am not able to access variables from an external Objective-C Library.
Since today I was able to access this variables:
extern NSString* const DEFAULT_URL;
This is defined in an Objective-C Header file from a precompiled .a framework.
In my swift code I only had to call DEFAULT_URL
.
Since Swift 2.2 I get the following errror:
Use of unresolved identifier 'DEFAULT_URL'
I am able to access the classes and methods of this framework, but I can't access extern NSStrings
.
Any ideas how to fix this?
@patrickS I had this for a silly reason, my extern const was defined inside an @interface in my .h file. This seems to have made it private to Swift code with this version of XCode / Clang. It applies to all extern consts not just NSString *.
e.g.
//In Foo.h
extern const int kBlah
@interface Foo
...
@end
instead of
//In Foo.h
@interface Foo
extern const int kBlah
...
@end
I had the same problem and as in the question, the ext strings were in my case in a dependency-managed (cough pod cough) third party library. So I could not easily move them around without messing everything up in the long run.
I found two solutions:
I leave it up to you which of the two solutions you deem less hacky (I went with solution 1, as I am lazy).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With