Check example code at Github: https://github.com/Sylvia-YiyinShen/SwiftOCInFramework
Probably, you will get an error when using Swift in Objective-c:
Receiver for class message is a forward declaration
Solution:
- Make Swift class/properties/functions exposed to Objective-C public
- @objc added for class/properties/functions
- Drag the Objective-C class(where Swift class is used) .h file to Headers section in Build Phases
- Import the Objective-C(where Swift class is used) .h file in Umbrella file in the framework
- Import <PROJECTNAME/PROJECTNAME-Swift.h> in Objective-C class(where Swift class is used)
No comments:
Post a Comment