Reputation: 40257
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.
Upvotes: 2
Views: 429
Reputation: 4451
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:
Swift
.Bridge-Header
file, create it.Objective-C
class into your Swift
file just import that Objective-C
file into your Bridge-Header
.Swift
class file into your Objective-C
controller so import "ProjectName-Swift.h" into your Objective-C
controller 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
How to call Objective-C code from Swift
How to import Swift code to Objective-C
Upvotes: 2