The framework packaging and swift programming languages have been introduced since iOS 8.0. We can mainly use the SWIFT programming language to package our own code into the framework. However, the current Xcode 7.x is not too smart to automatically import the framework package, so you need to do some cleanup.
First, when the framework is generated, structures, classes, enumerations, functions, and so on, which are exposed to the outside, need to be decorated with the public keyword, otherwise the external access to these types and functions is not available. In addition, in structs and classes, the method cannot be initialized by default, and must be exposed externally to the outside, otherwise it cannot be accessed.
Secondly, once we have created a good framework library, we first open the package directory of the framework, you can first use the Lipo command to integrate x86 with the arm of the different processor architectures (exec), and put it in the Framwork package generated by the device. Then copy all module files from the. Swiftmodule directory in the modules directory in the emulator framework package to the appropriate directory in the device Framework package. In this way, the finished Device Framework directory package can be compiled and connected by placing it in the actual project.
Finally, when we are going to run the emulator or run the real machine, we will paste the package copy of the framework that we just finished to the last generated in the products. The framework directory of the app package, which requires manual copy, or the program will run with an image not Found's error ~
Build and import the framework based on the swift programming language in iOS