A library.

  • Code sharing/protecting core code
  • Improved compilation speed/reduced code volume (system libraries are generally dynamic and do not reload)

Static library

  • . A file /. Framework
  • Copy it to your app at compile time
  • So it increases the code size/and is immutable

The dynamic library

  • .dylib/.framework
  • Only references are stored at compile time and loaded dynamically into memory at run time
  • No copy reduction in volume/performance penalty/security due to runtime loading

Ii. Production and integration

Static library creation

  • Create the static Library to implement the business logic

  • If you have any new header files, add them to the following position and recompile them

  • Select the emulator or real machine to compile and generate the. A file separately

  • If you need to merge the simulator/real static libraries

Execute the lip-create simulator. A true machine. A-output after merging. A

In order to reduce the size of the package, it is generally only hit the real hangarCopy the code

Static library integration

  • Static libraries (.a) are themselves binaries
  • The binary and header files need to be imported manually using double quotes
  • Special libraries need to set Other Linker Flags or the lowest supported version etc

Framework creation and integration

Framework authoring is just a way to package the library binaries, header files, and related resource files together for easy management and distribution.Copy the code

The framework make

  • Create framework files to implement the business logic

  • Set the public header file

  • Simulator/Real machine compilation separately (same as static library)

  • If you need to merge the simulator/real static libraries

Execute the lip-create simulator. A true machine. A-output after merging. A

The framework integrates

  • The framework itself contains header files

  • Set up the Embedded Binaries

  • Simply import the framework header file in Angle brackets

  • Generally, you need to set Other Linker Flags

3. Other

  • IOS 8/Xcode 6 added support for creating your own framework dynamic libraries, first with the advent of Extension. Extension and App are two separate executables that need to share code, in which case dynamic library support is essential. But this dynamic Framework is very different from the SYSTEM’S UIKit.Framework. The Framework of the system does not need to be copied to the target program. The Framework made by ourselves, even if it is dynamic, still needs to be copied to the App (the Bundle of App and Extension is shared). So Apple calls this Framework Embedded Framework.

  • A homemade framework can be set to static using Mach-o, as shown in the following figure