Build and import the framework based on the swift programming language in iOS

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.