Swift and Objective-C hybrid programming, swiftobjective-c
In the Swift project, you want to add Objective-C library support at the same time or use Objective-C programming at the same time.
Selecting the Objective-C system when adding a new file will automatically generate a file for a xx-Bridging-Header.h, and then put the Objective-C file to be referenced in the Swift project. h file # import "xxxx. h "can reference methods in OC in Swift files.
If the corresponding Bridging-Header file is not generated when you add an OC file, you can manually add one. h file, then name it xxx-Bridging-Header.h, select Swift Complier in Build Settings of the project, edit the content of the Objective-C Bridge-Header item to the newly added Bridging-Header file. Pay attention to the file path. Generally: ProjectName/ProjectName-Bridging-Header.h
Now, you can reference the OC method in Swift.