DEV Community

Cover image for Libraries, Frameworks, Packages: Frameworks.
Sergey Leschev
Sergey Leschev

Posted on • Edited on

Libraries, Frameworks, Packages: Frameworks.

A framework ( *.framework): is a hierarchical directory that encapsulates a dynamic library, header files, and resources, such as storyboards, image files, and localized strings, into a single package. Apps using frameworks need to embed the framework in the app’s bundle.

Frameworks intended for the same purposes as a static and dynamic shared libraries. But unlike libraries, frameworks:

  • can include resources like images, assets, documentations, strings files.
  • only one copy of framework read-only resource loaded to memory, that allows to decrease memory footprint and share framework between iOS app and extensions.

Umbrella framework: is a framework bundle that contains other frameworks.

Universal framework (fat framework): multi-architecture binary that contains code native to multiple instructions sets and can run on multiple processor types. In short, it contains code compiled for all the platforms which you are going to support. For example, x86_64 (64-bit Simulator), arm64 arm64e armv7 armv7s for devices. As a result, such a framework will have a larger size than a one-architecture framework.

You can expect framework with file command in Terminal:

file <Path>/<FrameworkName>.framework/<FrameworkName>
Enter fullscreen mode Exit fullscreen mode

To inspect all the dynamically linked frameworks and libraries to a binary you can use otool:

otool -L <Path>/Products/Applications/<AppName>.app/<AppBinary>
Enter fullscreen mode Exit fullscreen mode

XCFrameworks is a new supported way to distribute binary frameworks. Actually a framework that now can containing code for multiple architectures and platforms. You will still be required to generate archives for different platforms and bundle them up together in single XCFrameworks.

There are few advantages of using XCFrameworks:

  • XCFramework contain variants not only for device and Simulator, but for any of the platforms that Xcode supports: iOS, macOS, tvOS, watchOS.
  • It supports Swift and C-based code.
  • Can bundle up frameworks and static libraries. It is possible to make Swift packages that include one or more XCFrameworks.

Next Article: Swift Packages.


Contacts
I have a clear focus on time-to-market and don't prioritize technical debt. And I took part in the Pre-Sale/RFX activity as a System Architect, assessment efforts for Mobile (iOS-Swift, Android-Kotlin), Frontend (React-TypeScript) and Backend (NodeJS-.NET-PHP-Kafka-SQL-NoSQL). And I also formed the work of Pre-Sale as a CTO from Opportunity to Proposal via knowledge transfer to Successful Delivery.

🛩️ #startups #management #cto #swift #typescript #database
📧 Email: sergey.leschev@gmail.com
👋 LinkedIn: https://linkedin.com/in/sergeyleschev/
👋 LeetCode: https://leetcode.com/sergeyleschev/
👋 Twitter: https://twitter.com/sergeyleschev
👋 Github: https://github.com/sergeyleschev
🌎 Website: https://sergeyleschev.github.io
🌎 Reddit: https://reddit.com/user/sergeyleschev
🌎 Quora: https://quora.com/sergey-leschev
🌎 Medium: https://medium.com/@sergeyleschev
🖨️ PDF Design Patterns: Download

Top comments (0)