Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Required Framework vs Static Library

Building Modern Frameworks says every app has its own copy of a custom framework. Now that Xcode supports iOS frameworks, is it still true that frameworks are static libraries but just more convenient? If that's true, then why choose the static library template? Otherwise, should I convert all my required custom frameworks to static libraries once Swift supports static libraries?

like image 306
ma11hew28 Avatar asked Mar 29 '16 13:03

ma11hew28


People also ask

What is the difference between static library and framework?

Framework: It is a package that can contain resources such as dynamic libraries, strings, headers, images, storyboards, etc. Static library: A unit of code linked at compile-time, which does not change. (Can only contain code).

What is difference between library and framework?

Libraries provide developers with predefined functions and classes to make their work easier and boost the development process. Framework, on the other hand, is like the foundation upon which developers build applications for specific platforms.

What is difference between framework and XCFramework?

Whereas Universal Frameworks contain many slices without knowledge of the platform SDK for each one, XCFrameworks contain many slices organized by platform. Because of this platform-awareness, an XCFramework can target more than one platform for the same architecture, which solves our problem.

How do I know if my framework is static or dynamic?

In Static, Code can't be changed without recompiling application as code is copied into executable binary. In Dynamic, Code can be changed without recompiling application as it's resolved at runtime.


1 Answers

Frameworks serve the same purpose as static and dynamic shared libraries, that is, they provide a library of routines that can be called by an application to perform a specific task. For example, the Application Kit and Foundation frameworks provide the programmatic interfaces for the Cocoa classes and methods. Frameworks offer the following advantages over static-linked libraries and other types of dynamic shared libraries:

  1. Frameworks group related, but separate, resources together. This grouping makes it easier to install, uninstall, and locate those resources.

  2. Frameworks can include a wider variety of resource types than libraries. For example, a framework can include any relevant header files and documentation.

  3. Multiple versions of a framework can be included in the same bundle. This makes it possible to be backward compatible with older programs.

  4. Only one copy of a framework’s read-only resources reside physically in-memory at any given time, regardless of how many processes are using those resources. This sharing of resources reduces the memory footprint of the system and helps improve performance.

This excerpt taken from here.

like image 66
dev gr Avatar answered Oct 08 '22 19:10

dev gr