Skip to content

Commit 9ec72ee

Browse files
committed
add build post
1 parent dad5640 commit 9ec72ee

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: "How iOS Apps Are Built: From Source Code to Libraries"
3+
4+
categories:
5+
- iOS
6+
- Basic Concept
7+
tags:
8+
- Library
9+
- Build
10+
---
11+
12+
![image](./assets/img/post/build.png)
13+
14+
## Static Library vs. Dynamic Library
15+
1. How to include in an app
16+
1. Static libraries: You only need to **Link**.
17+
1. Dynamic libraries: You need to **Link + Embed**.
18+
1. Link writes Dynamic Library References (LC_LOAD_DYLIB) into the executable.
19+
1. Embed places the linked library binary (the .dylib inside the .framework) into the app bundle (usually at .app/Frameworks) and signs it.
20+
1. The settings for linking and embedding (e.g., Link Binary With Libraries) are often managed automatically by dependency managers such as SPM, CocoaPods, or Carthage.
21+
1. Advantages
22+
1. Static libraries
23+
1. Faster launch time
24+
1. Dead-code strip
25+
1. Dynamic libraries
26+
1. Shared across targets or modules
27+
1. Faster linking, since all `.o` files do not need to be merged into the executable
28+
1. With ABI stability (Library Evolution enabled), incremental rebuilds can often be avoided when the library changes
29+
30+
## System Framework (ex. UIKit, Foundation)
31+
They are provided as dynamic libraries, but they are **embedded in the OS**. Therefore, you only need to link. Basic frameworks such as UIKit and Foundation are linked when you make an app template. But for additional frameworks such as ARKit, you need to link.
32+
33+

assets/img/post/build.png

116 KB
Loading

0 commit comments

Comments
 (0)