I have a project, in the Framework, there have *.framework
, *.dylib
, *.a
libs.
I want to know what's them? and the difference between them.
Libraries and frameworks are basic building blocks for creating iOS and macOS programs. Libraries are collections of code and data, while frameworks are hierarchial directories with different kinds of files, including other libraries and frameworks. Based on how libraries are linked, they can be static or dynamic.
A file with the DYLIB file extension is a Mach-O (Mach Object) Dynamic Library file that an application references during runtime in order to perform certain functions on an as-needed basis. The format has replaced the older A. OUT file format.
.dylib stands for dynamic library. A Static library (.a) A Static library (. a) is a pack of compiled classes, functions which can be used together with iOS app development project. It is a compiled binary or fat file and can be shared between projects.
Static frameworks contain a static library packaged with its resources. Dynamic frameworks contain the dynamic library with its resources. In addition to that, dynamic frameworks may conveniently include different versions of the same dynamic library in the same framework!
First of all, a library is a collection of resources and the code itself, compiled for one or more architectures.
Static libraries (*.a):
In the case of
static libraries (*.a)
, the code that the app uses is copied to the generated executable file by a static linker during compilation time.
Dynamic libraries (*.dylib):
Dynamic libraries (*.dylib)
are different from static libraries in the sense that they are linked with the app’s executable at runtime, but not copied into it. As a result, the executable is smaller and, because the code is loaded only when it is needed, the startup time is typically faster.
For frameworks, we first need to understand the bundle concept (as a framework is a specific kind of a bundle). A bundle is a file directory with subdirectories inside. On iOS, bundles serve to conveniently ship related files together in one package – for instance, images, nibs, or compiled code. The system treats it as one file and you can access bundle resources without knowing its internal structure.
The library may also have additional resources: headers, localization files, images, documentation, and examples of usage. We can bundle all of this together in one bundle – and the name of this is the framework.
Static frameworks contain a static library packaged with its resources. Dynamic frameworks contain the dynamic library with its resources. In addition to that, dynamic frameworks may conveniently include different versions of the same dynamic library in the same framework!
Hackernoon
Runtastic
Static library
Software framework
Thanks for accepting my answer!
Compiled for one or more architectures?
Every architecture requires a different binary, and when you build an app Xcode will build the correct architecture for whatever you’re currently working with. For instance, if you’ve asked it to run in the simulator, then it’ll only build the i386 version (or x86_64 for 64-bit).
This means that builds are as fast as they can be. When you archive an app or build in release mode, then Xcode will build for all three ARM architectures, thus allowing the app to run on most devices. What about the other builds though?
Naturally, when you build your framework, you’ll want developers to be able to use it for all possible architectures, right? Of course you do since that’ll mean you can earn the respect and admiration of your peers.
Therefore you need to make Xcode build for all five architectures. This process creates a so-called fat binary, which contains a slice for each of the architectures.
arm7: Used in the oldest iOS 7-supporting devices
arm7s: As used in iPhone 5 and 5C
arm64: For the 64-bit ARM processor in iPhone 5S
i386: For the 32-bit simulator
x86_64: Used in 64-bit simulator
Raywenderlich: Multi-Architecture
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With