Import OC into Swift Project
You’ll need to edit the bridging header file to expose your Objective-C code to your Swift code.
该文件的作用就是把OC代码曝光给Swift,意思就是Swift文件要想使用OC代码,必须通过此文件做桥接。
OC Use Swift Code
When you import Swift code into Objective-C, you rely on an Xcode-generated header file to expose those files to Objective-C. This automatically generated file is an Objective-C header that declares the Swift interfaces in your target. It can be thought of as an umbrella header for your Swift code. The name of this header is your product module name followed by adding
"-Swift.h"
. (You’ll learn more about the product module name later, in Naming Your Product Module.)
Product Module Name-Swift.h
作用把Swift代码曝光给OC
不管是谁导入谁,直接看谁使用谁。
如果OC文件要使用Swift文件,必须通过 Product Module Name-Swift.h
进行桥接。