Swift_cocoapos import third-party library _ bridge file

  • SwiftUse the podimported third-class library to use it easily.
    In Swift5.0here, you can directly use the podimported third-party library without using the bridge file. importYou can use the third-party library directly by directly using the third library class name.
    Insert picture description here
    However, such a processing method requires an importoperation that needs to be performed in every place where the third party is needed , which is too troublesome.

  • Use bridge files to achieve the same effect as Objective-Cinternal pchfiles

1. Create a file, select Create Header File, and name the file for distinction xxx-Bridging-Header.
2. Modify the configuration and open it Build Setting.
2.1. Search Objective-C Briding Header, and then perform similar operations as shown in Figure
Insert picture description here
2.2. Search User Header Search Path, and then perform operations as shown in Figure
Insert picture description here
2.3. Import third-party libraries xxx-Bridging-Heade.h, as shown
Insert picture description here
in the figure. After performing the above operations, do not perform importoperations where third parties are needed . The effect is as follows:
Insert picture description here

Note: When podimporting a third party, you also need to pay attention to some operations, Profileadd use_frameworks!this line of code to the file.
Insert picture description here

Guess you like

Origin blog.csdn.net/FlyingKuiKui/article/details/94137556