izik461 izik461 - 1 year ago 76
Swift Question

Bridge Objective-C to Swift - can't see file

I am writing an app for Apple Watch and I want to include

used in corresponding iPhone app (written in ObjC) into the watch app (swift).
I've tried Apple tutorial for that (https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html), but the bridging file doesn't see the actual header file.

Probably the error is caused by the fact, that watch extension is separate target, but where and how should I specify the files to be included?

What's more, when including constants.h in the bridge file, all the constants are showing editor errors:


Answer Source

NSString is part of Foundation. The compiler is complaining that it can't resolve that type. Add #import <Foundation/Foundation.h> to the top of your header.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download