Why do we need to create frameworks? because it has three major purposes mentioned below and also you can share your code with your team, other developer or iOS community.
- Code encapsulation
- Code modularity
- Code reuse
Let’s create the iOS framework.
Now just give some meta-data about your framework like name, organization, identifier etc (I hope you’re already aware of it).
We’re good to go till now. Just add the files that you want to keep within your framework.
Build the framework project to make sure that you get build succeeded with no build warnings or errors.
Things that you need to take care.
- Make sure to check Copy items if needed, so that the files actually copy into the new project instead of just adding a reference. Frameworks need their own code, not references, to be independent.
- Double-check that each of the files has Target Membership in ThreeRingControl to make sure they appear in the final framework. You can see this in the File Inspector for each file.
- Double-check the access modifiers, while creating framework access modifiers plays very important roles.
- if you’re creating Swift framework make sure you’re extending classes from NSObject otherwise it won’t reflect once you will import the framework.
Thanks for reading.