How add Objective-C files in a Swift Cocoa Touch Framework
This post is a tip to know how add third libs or files in Objective-C in a Swift Cocoa Touch Framework projects.
Are three simple steps, so let’s begin!
The first thing to do is add the Objective-C files inside the project (could be dragging and dropping).
After put the files in the project is necessary to go in Project Target -> Build Phases -> Headers.
There will see all ‘.h’ files inside the Projects tab. You must drag and drop all files to Public tab. See bellow:
Now all ‘.h’ files are publics in your project. To make them usable is necessary do one more thing.
The last thing to do is import them in the Bridge file (is created automatically by Xcode).
The Bridge is usually is the name of the project with the ‘.h’ extension.
Note: If the project is called MyProject, the name of the Bridge file will be MyProject.h.
Open the Bridge file and bellow the import <UIKit/UIKit.h> add all Objective-C headers in the Project.
Done! Now all project is available to use those Objective-C files in Swift files.