Static vs dynamic library?
The gist
- Static (
.a, static framework) — the object code is copied into the app binary at link time. Launch is faster (dyld loads fewer images), dead code is stripped by the linker, but the binary grows, and the same library linked into several dynamic frameworks produces duplicate symbols and the warningClass X is implemented in both…. - Dynamic (
.dylib, dynamic.framework) — a separate Mach-O image that dyld loads at launch (or lazily viadlopen). Code and resources can be shared between the app and its extensions (one framework in the bundle, referenced by several targets), but every embedded framework is dyld work at startup: dozens of dynamic frameworks noticeably slow pre-main.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep