Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SheldonWangRJT/78c9bd3b98488487c59a6a4a9c35162c to your computer and use it in GitHub Desktop.
Save SheldonWangRJT/78c9bd3b98488487c59a6a4a9c35162c to your computer and use it in GitHub Desktop.
iOS Dynamic vs. Static Library / Framework

iOS Dynamic vs. Static Library / Framework

Find me on Github, Facebook, Youtube, etc by #iOSBySheldon.

Concept

Library and Framework are not same but close. Frameworks are just libraries with linking (binding). In other words, frameworks are just libraries that are bundled into targets. Therefore, their file extensions are different.

File Format

  • Static Library - xxxx.a
  • Dynamic Library - xxxx.dylib
  • Framework - xxxx.framework

Framework

  • A framework is a hierarchical directory that encapsulates shared resources.
  • A framework is also a bundle and its contents can be accessed using Core Foundation Bundle Services or the Cocoa NSBundle class.

Dynamic Framework

Dynamic framework works at runtime, a single copy of the library’s code is shared among all the processes using it, thus reducing memory usage and improving system performance. Through dynamic binding, frameworks can be updated transparently without requiring applications to relink to them.

Umbrella Framework:

The purpose of an umbrella framework is to provide all the necessary interfaces for programming in a particular application environment. Umbrella frameworks hide the complex cross-dependencies among the many different pieces of system software. Thus you do not need to know what set of frameworks and libraries you must import to accomplish a particular task. Umbrella frameworks also make faster builds possible through the use of precompiled headers. Example, UIKit is an Umbrella Framework including sub-frameworks like CoreAnimation, Quartz, etc..

Fun Fact

Interesting Note: Swift won't allow static libraries that include Swift code

References

@SheldonWangRJT
Copy link
Author

Converted text file to markdown for better readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment