To use swift code in Objective-c project ->
1. Go to your objective-c project -> create a new file -> source -> Cocoa Touch Class -> change language to Swift -> create.
2. Now a alert will pop-up Would you like to configure an Objective-C bridging header? click yes.
3. This will automatically Create a bridging header Project_name-Bridging-Header.h in your project.
To use Swift file in your objective-c Class
1. Go to your objective-c Class in which u want to use Swift code.
2. import Project_name-Swift.h here .
example -
#import"ProjectName-Swift.h"
To use objective-c file to your swift Class
1.Go to bridging header class Project_name-Bridging-Header.h.
2. import only that objective-c file which u want to use in your swift class.
example -
#import "FileName.h"
0 Comment(s)