A legacy project was done on Objective-c, where there is a tab view. A full new feature is required with a new tab which I want to implement on Swift. Right now there is no time to convert full project into Swift but the new feature is to be implemented on Swift. Can anyone guide me how can I implement the new feature in Swift just adding a new Tab on Objective-c UI.
2
-
This can achieved by using a bridge header class. stackoverflow.com/questions/24002369/…Anirban iOS– Anirban iOS2016-12-15 05:26:39 +00:00Commented Dec 15, 2016 at 5:26
-
stackoverflow.com/questions/24102104/…, refer thisKAR– KAR2016-12-15 05:29:50 +00:00Commented Dec 15, 2016 at 5:29
Add a comment
|
1 Answer
You can confidently start using Swift files in your Objective-C project. There is no need to convert full project into Swift
You can follow below steps to use Swift class in your project:
- Create new Controller Class in
Swift. - It will pop up for
Bridge-Headerfile, create it. - If you want to use any
Objective-Cclass into yourSwiftfile just import thatObjective-Cfile into yourBridge-Header. - If you want to use
Swiftclass file into yourObjective-Ccontroller so import "ProjectName-Swift.h" into yourObjective-Ccontroller class.
important : "ProjectName-Swift.h" would be Module name. If you have multiple targets in your project the use "TargetName-Swift.h"
Please follow below links: https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html