Create Swift Framework + Cocoapods
Create your own iOS framework and distribute using cocoa pods. Is it easy? yeah, It is 😄. Hope you are familiar with cocoa touch other frameworks like UIKit.framework. you can create your own framework using your code.
Let’s start, first create an Xcode project by selecting a template for our project Cocoa Touch Framework from the iOS tab.
Click Next and Give your framework name and save to your specific location. As a simple example, add
IPSwiftExtensions.swift. I tend to keep my source file under, but it’s to your own preference.
Notice that the class is public, and the members are implicitly public or private according to our requirement.
Next, you can see the Build configuration is set to Debug. It means that whenever you run this project it will create our framework in Debug mode so if we want to use this framework in our application we switch to Release mode. Select your framework target and Navigate to Product->Scheme->Edit Scheme.
Run your project by pressing Command+R and build the framework. Now you can see the framework in products folder. Right click on it and select show in finder
Now, you can use this framework in your any project. just you need to add it like the other frameworks.