Prior to iOS 8, Apple is disallowing “dynamic” library / framework in iOS for other developers. Comparing to the normal “static” library, iOS developers are more willing to distribute their libraries as “frameworks“. However, Xcode does not contain the functionality to create “static iOS framework“. Then things get confused here – since Xcode supports building “static framework for OSX“, we can therefore build the “static iOS framework” following the similar path used for “OSX“.

Only Apple could create dynamic frameworks(like UIKit.framework). Technically you can still build the dynamic library for iOS and load it at runtime. But your app will get rejected when submitting to Apple.

Things get even more confused after iOS 8 is introduced – now Apple does allow the using of “dynamic” library / framework in distribution, and Xcode also provides the tool to create it. But, the “dynamic” library / framework only support iOS 8 and above and Xcode still does NOT provide the way to create “static iOS framework“……

Here are the normal questions based on the confusions and quick answers:

  • Can “dynamic” library / framework be “used” before iOS 8, like iOS 7?
    • Yes, but it needs some special tweak, with some limitations. Check here
  • Can we use the “Cocoa Touch Framework” option in Xcode 6 to build a “static iOS framework”?
    • Technically YES, but not recommended only if your framework needs to support iOS 7 and below.
    • It is done by changing the “Mach-O Type” to “Static Library“.
  • Can we do a universal iOS framework for “Cocoa Touch Framework”?
    • Yes. Similar way as we do for “universal static iOS framework”.
  • Can Swift be used to create “static iOS framework”?
    • NO. When you select “Cocoa Touch Static Library” from Xcode, there is no option for you to choose Swift.

Here is a detailed breakdown for “Framework” and “Library” on iOS.


In programming world, Library refers to a well-defined and prepared collection of object files used by other programs.

It generally has two types:

  • Static Library – the library is copied into the a target executable ()application) by a compiler, linker or binder at the compile-time.
    • When the library needs an update, the target application needs to be re-compiled with the new library.
    • If multiple applications use the library, it will be copied into every application.
  • Shared Library – instead of “copying” the actual code into the application, only the “reference” is included into the target executable at the compile-time.
    • The actual library file is physically stored in another place.
    • The library will be loaded into the memory at runtime, and shared amongst multiple applications processes.

On OSX and iOS, Shared Library has an extension of .dylib (Dynamic Library).


Library only has executable code (compiled library binary). When you distribute the library, you need to include not only the library itself, but also any public include files, resources, scripts etc. Using framework is a good way to ship all of them together.

On iOS, the framework can only contain header files and a static library. If there is a need to also distribute the resources (like xibs, image assets, etc.), use “Resource Bundle” instead.

Similar to Library, framework also has two types:

  • Static Framework – similar to “static library”.
  • Dynamic Framework – similar to “dynamic library”.

You may also heard another term about using framework on iOS – “Embedded Framework” – it also includes the resources, like xibs, image assets, etc. However, since Xcode does not support it, it has a few minor issues with embedded framework.

Here are some limitations of using framework on iOS:

  • Previously static only, iOS 8 adds support to “dynamic”, still with limitations.
  • It cannot include resource while framework on OSX can.

Although it has limitations in using framework on iOS, but it still provide much benefit when distributing the library.

Dynamic Framework on iOS 8

Comparing to the normal “dynamic framework” on OSX, using it on iOS still gets the following limitations:

  • Not truly “dynamic” (“shared”) – you cannot distribute the dynamic framework separately. It must be distributed within your iOS application.
  • Not include resources.

The main reason for Apple to open the support of “dynamic framework” is because of the “extensions“. Since your extension needs to be accessible for other applications, it has to be shipped as a “dynamic” (shared) library.

How to Build Universal “Static” and “Dynamic” Frameworks

Here are two great resources that can help build “Universal” static and dynamic frameworks:


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>