Create Framework in Swift
suggest changeFollow these steps to create a custom framework in Swift for iOS:
- In Xcode, create a new project.
- Choose iOS > Framework & Library > Cocoa Touch Framework.
- Click Next and set the product name.
- Click Next and choose the directory for the project.
- Add code and resources to the framework project.
To use that framework from another app, create a workspace and add both the app project and the framework project. Then:
- Open the General tab of the app target.
- Drag the
.frameworkproduct from the framework project into Embedded Binaries. In later Xcode versions that section is named Frameworks, Libraries, and Embedded Content. Choose Embed & Sign. - In each Swift file that uses the framework, add
import FrameworkName, using the frameworkâs module name.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents