First, Introduction
As Swift matures, the use of swift development or hybrid development has become a trend, and Apple is recommending the use of Swift as a new language. Swift has now been updated to 3.0, and it is estimated that no more than 4.0 will come out. Then there are some unavoidable problems when developing with Swift, and the following are some common problems to solve.
ii. Problems and Solutions
- How do I manually bridge oc in Swift?
1. Create a swift bridging file
2. Set the path of the bridge file, that is, the path of the objective-c bridging header, you can import the custom OC class file after Setup, using the
- How do I use Cocoapods to integrate third-party libraries?
The swift language is added use_framework! when configuring Podfile files with Cocoapods. The purpose of this code is to package the three-party library into a static library for developers to use.
- How do I import a third-party library that uses Cocoapods integration? Here I use Mjrefresh example
1, #import "MJREFRESH.H" after you want to set up a user Header Search Paths, otherwise you need to use a three-party library is not adjustable.
Locate the search Paths in the Target->build setting, and double-click the empty space behind the user Header Search Paths to set the directory path to ${srcroot}.
${srcroot} Select all the files under the recursive directory.
2, be careful not to #import<mjrefresh/mjrefresh.h> such import. When referencing a three-party library, you need to declare it as a constant or variable in the method to associate the file within the library.
Use Mjrefresh as follows:
Swift: Bridging OC Files in Swift (class files you create, third-party library files)