importing swift framework into a objective-c project
You have to add @objc
to the declaration of the VeediUtils
class, or make it inherit from NSObject
. Otherwise it won't be visible to Objective-C.
In your case, RecognizedClass
is recognized because it is a subclass of UIViewController
, which is a subclass of NSObject
.
If you previously configured Project for integrating with Swift and want to use Swift Dynamic Framework, you have to import it like this way (replace {value} with appropriate names depending on your Project):
#import <{MyFramework}/{MyFrameworkMainClass}-Swift.h>
#import "{YourProjectTargetName}-Swift.h"
EDIT:
If your framework has Defines Module
set to true
, then you can import it like this:
@import MyFramework;
To access a swift class in objc, that is not inherited from NSObject you need to:
@objc public class VeediUtils
A Swift class or protocol must be marked with the @objc attribute to be accessible and usable in Objective-C. This attribute tells the compiler that this piece of Swift code can be accessed from Objective-C. If your Swift class is a descendant of an Objective-C class, the compiler automatically adds the @objc attribute for you.
https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html