Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • how to merge objc and Swift code in same project

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 467
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: