Create your own Cocoa Touch Farmework in swift 3.0

Updated 26 October 2021

Save

Framework

Sometimes we need to write the many repetitive functions which are used in many places as well as in many projects, for this we need to define the common class and where we declare and define all function . for doing this we can make common framework where we can only include in our app and access all its functionality.

There are two ways to use:

1: Include the whole framework like include sample.xcodeproj

2: Using Pod (where we can get time to time update).

Now we are describing how to start:

1: Go to file and select new project.

2: Here select “Cocoa Touch Framework” and  named as “Sample”

3: It will default add .h file in root directory.

4: Now you can take the swift file or (objective c file)  by simply on add.

5: Example:

We have taken HelperClass.swift file then it will show like that:

For accessing in your project then we have declared as “Public” then it will be accessible.

6: Now start writing the helper function :

Here we have taken the

example of Email check :

7: Now you have yo use this :

a: Build this project and close;

8: Copy the Sample project ( Your framework) in your usable project folder.

9: double tap on Sample project and it will show “SampleFramework.xcodeproj” now drag and drop to the root of your project.

10: Now select your usable project and go to target and include “Sample.framework”;

11: Now you able to import your framework.

12:

13: and now you are able to use the function which you have declared in your HelperClass.

Note:

In Next update, we will  provide the information regarding  “how to use this using “POD” “

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home