I have written a library in Swift and I wasn\'t able to import it to my current project, written in Objective-C.
Are there any ways to import it?
#i
There's one caveat if you're importing Swift code into your Objective-C files within the same framework. You have to do it with specifying the framework name and angle brackets:
#import
MyFramework
here is the "Product Module Name" build setting (PRODUCT_NAME = MyFramework
).
Simply adding #import "MyFramework-Swift.h"
won't work. If you check the built products directory (before such an #import
is added, so you've had at least one successful build with some Swift code in the target), then you should still see the file MyFramework-Swift.h
in the Headers
directory.