You should import this file wherever you wish to use Swift code in your project. Create a constant file like “ObjectiveC-Constants.h” and import this in that file. No need of importing it in every Objective-C file. In case you wish you use Swift code in Objective-C, you may import the swift auto-generated header for your project. MyApp-Bridging-Header.h Using Swift-Code in Objective-C h file and name it as -Bridging-Header.h and it works same as the one Xcode created for you. In case you click on “Don’t Create” by mistake, its fine. You may import any Objective-C file here to be able to use it in Swift files. h file which acts a bridge between Objective-C and Swift. m file in your Swift project, it asks you to automatically create a bridging header. The beauty of XCode is that the moment you add a. Objective-C files can be added in your Swift project by a simple drag and drop. The Objective-C code was in MVC which was the biggest challenge here. It had its own network layer and its own Image Service. I had created my Swift project in pure MVVM architecture with few enhancements. After sometime, because of tight deadlines, I had to integrate some of the Objective-C written code into my Swift project. Recently, I had to revamp my application in terms of design and features and we decided to create a new project in Swift language all together. In this article, I am going to share the challenges I faced while integrating Objective-C code into my newly built Swift application.
0 Comments
Leave a Reply. |