They are two kinds of frameworks in IOS
*Static Framework (Static library)
*Dynamic Framework
Prior to xcode 6 apple use to allow developers only to create static library to distribute ,If we need to create dynamic libraries we need to rely on other scripts and resources.
Why do we need to create dynamic libraries ? what is the difference between static and dynamic libraries?
Static Library :
When you Compile a program with static libraries statically linked libraries are linked into the final executable by the linker which increases the size of the executable. Likewise when a library needs to be updated you'll need to compile the new library and then recompile the application to take advantage of the new library
Dynamic Library :
Libraries that have the library name embedded into the executable but the library itself not compiled into the binary file.This makes upgrading libraries easier
Getting Started to create Custom Dynamic Library :
Xcode ->Select Project ->ios->Framework & Library ->Cocoa Touch Framework
Now add objective C model files as shown below
Declare a method to log some message when we access the method from framework class and make sure that file is public .To do that we need to in two steps first click on the file on the right side under target membership change to public or under build phases ->header move to header section
In the second step go the file DistributeFramework.h import the file in order make it access to public
Now in the build settings ->Architectures ->Valid Architectures add i386 to get it compile for both ios simulator other wise it only builds for the device .If we build for ios device it only builds for device ..so we need to build for ios device and simulator which creates two folders .
Create a single view bases application, Drag the similar folder .framework as we are running on the simulator and add the framework as we do for usual framework imports .Now under build phases add copy files change option to frameworks and add framework under it.
Ready to use framework :)
Please drop in comments for any questions