iOS create a third-party framework

Source: Internet
Author: User

I. Create a step

First step, creating Workspace Huanghuacai.xcworkspace

The second step: give your frame a domineering side leak name, but before the name to check the weight, to see if your name already exists, you can enter the following command on the terminal

Pod Search Name

In the third step, the framework is usually service to the application, so create a new single-View Application project in workspace.

Note: When you save, you should select the Huanghuacai that was created before this project

Create git This option do not tick

Fourth step: Create a new framework named Huanghuacai. Xcode6 has launched a cocoa Touch FrameWork, where we can select it

As with the third step, add the newly created program to the Huanghuacai workspace

The fifth step is to create a new source directory under the Huanghuacai directory, which is used to save the framework file, and a separate directory is created to facilitate the open source framework's use

Sixth, drag the Source directory to the project and take care not to select Copy

Seventh Step, new Qrcode.swift

Import uikit//1. The class is set to public class, and external access is allowed to Huanghuacai:nsobject {    //2. If you want to open a method to an external call, you need to use the publicly keyword public    func SayHello () {        println ("Hello")    }        Func Saygoodbye () {        println ("Bye Bye")    }}

eighth step, compile the Framework and add the following code to the Huanghuacai-ios appdelegate

Let Huanghuacai = Huanghuacai () println (HUANGHUACAI)         Huanghuacai.sayhello ()

Nineth Step, test

Two. Adding source code Control
~/dev/github/gitignore/" New Frame project "
Three. Summary of the framework
    • After you have made any changes to the Framework, you must first compile the
    • Class requires public
    • The public Init constructor is required, otherwise the object cannot be instantiated by the outside world
    • The method that needs to be developed needs public, otherwise the outside world cannot call

iOS create a third-party framework

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.