Create a Custom framework in iOS
Create Framework in Swift
follow these step to creating Custom Framework in Swift-IOS:
- Create a new project. In Xcode
- Choose iOS/Framework & Library/Cocoa Touch Framework to create a new framework
- click next and set the productName
- click next and choose directory to create Project there
- add code and resources to created project
Framework created successfully
to add created framework to another project, first you should create a workspace
add “target project” and “framework project” to workspace, then :
- go to the general tab of target project
- drag the “*.framework” file in product folder of framework project to “Embedded Binaries” section
- to use in any ViewController or class just import framework at each file