After creating a swift project, if you want to create a new OC file later, a appname-bridging-header.h file is generated
One, in the Swift file
1> Referencing Swift files
Nothing needs to be done, and in all swift files, you can use each other.
2> Referencing OC Files
The OC header file to be referenced is imported into the Appname-bridging-header.h file and can be used in all swift files
Second, in the OC file
1> Referencing Swift files
The swift language-created project automatically generates a appname-swift.h file that contains the header files for all swift files, so using the Swift class in an OC file simply imports the Appname-swift.h file, which is #import " Appname-swift.h ", then you can use all Swift classes in this OC file
2> Referencing OC Files
Import the header file to use the OC file eg. #import "UsedOcFile.h"
Summarize
|
Calling the OC Code |
Invoke Swift code |
| Swift file |
Dependent Appname-bridging-header.h |
No need to declare |
| OC file |
#import "OC.h" |
#import "Appname-swift.h |
IOS Swift Project OC and swift Mix, file mutual references