I've aded bridging header, specified in build settings the full path to it, bridging header was created automatically. After this, i've included my obj-c header files in it. But every attempt of calling constructor of object fails : "Use of undeclared identifier".
The list of things i've done :
- Created .m file and Xcode proposed to create bridging header
- Added obj-c files to project and imported them in header
- In build setting provided the FULL path to bridging header file
- Used Obj-C type in code... But it doesn't builds.
- Then, i provided not the full path to the header, but the path from the folder in which project is - no result.
I double-checked all the steps according to apple documentation, but no result. Why? Any help would be appreciated.
Well, after creating a test project with bridging header, I found out the following:
I added .m file, Xcode proposed me to create bridging header.
I added .h file, named it as class and created Obj-C class in this way.
AND:
In build settings - code generation section looks like this:
Bridging file located at the following path:
ProjName / BridgHeader.h
At the same level as .xcodeproj file exists.
BUT:
When I added already created Obj-C class to project and added header import in bridging header, I couldn't use it:
So, I guess, Xcode 6 beta 2 cannot add existing files to swift project. Did anyone face this trouble? Cause I don't want to paste all existing libraries, that I was developing for 5 years to created files.
P.S:
Bridging header:
Follow these steps:
If followed the above steps, and still have the error. It is probably that you didn't declare a class named BL_KeyChainWrapper in BL_KeyChainWrapper.h. Make sure in your BL_KeyChainWrapper.h, you have code like following: