I am trying to write a new feature of my objective-project in Swift. I have an existing Object-C file called NSString + Extensions, such as
@interface NSString (extension)
The file has been named NSString .Extensions I have some application specific example methods (eg: stringByRemovingSpecialCharacters) I've added a header file (bridging header), this is typical in the swift compiler - code generation in my project settings. I have added #import "NSString + Extensions.h" to that header file, but no way from the extension file can be called swift file. How do I use this extension file in Swift? I have more expansion files - NSDT + encryption H etc., I would also like to use it.
If you add an Objective-file to the SWIFT project, ask if you want to add one The purpose is a bridging header, for which you answer yes. Then you should import your file into the bridging file and it will allow you to call your swift file. PS You can then remove the Objective-file which is no longer used.
Comments
Post a Comment