0

I'm trying to make clear what is the difference between a library and a framework, in particular in iOS development, and I've been reading some blogs and posts and they give different explanations of them. For example, CocoaPods describe them different from this post.

I'd appreciate an updated and simple explanation of what a library and a framework are, and their main differences.

Thanks in advance.

Community
  • 1
  • 1
AppsDev
  • 11,441
  • 20
  • 81
  • 163

1 Answers1

1

In Cocoa, a library is a single file, containing executable code that is linked during the build (static) or at runtime (dynamic). They have the extension .dylib (dynamic) or .a (static). Occasionally dynamic libraries will have the extension .so, particularly if they have a Unix history.

In Cocoa, a framework is a group of files in a directory structure, which will generally include a library, but may also include resources, other libraries, or even other frameworks. The directory has the extension .framework.

Occasionally frameworks will be called libraries as a generic term for "shared code." Occasionally libraries will be called frameworks as a generic term for "a unified infrastructure that the application relies on." But for Cocoa, the words generally refer to the packaging.

Rob Napier
  • 250,948
  • 34
  • 393
  • 528