I've been digging into Swift since last night and I've encountered something strange. I have included a few ObjC classes in my Swift project -- making use of the Bridging Header. However, when I attempt to build the project, the Swift compiler complains because, by all appearances, it is attempting to compile the ObjC code. Is there a step I'm missing here? Has anyone else encountered this problem and found a solution?
I have scoured the docs, to no avail.
It turns out this was a silly oversight on my part. Many third-party ObjC libraries/code do not include Foundation -- assuming it would already be present. Of course, in Swift, this is not the case.
Once I added #import <Foundation/Foundation.h> to my imported header, all was well.
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