Skip to content

Commit 58a06c7

Browse files
committed
update readme
1 parent e0b68cb commit 58a06c7

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

README.md

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,45 @@
11
# cocoapods-static-swift-framework
22

3-
A description of cocoapods-static-swift-framework.
3+
A cocoapods plugin that enables static frameworks for all pods, and sovles the problems in swift integration.
44

5-
## Installation
5+
## The problem to solve
66

7-
$ gem install cocoapods-static-swift-framework
7+
When turning on `use_framworks!` in podfile, libraries will be used in form of (dynamic) framework. App boot time will be affected dramatically when there're too many frameworks ( like 100 ), also a dyld [crash](https://github.com/Ruenzuo/cocoapods-amimono#why-would-you-want-this-plugin-in-your-podfile) and an obvious time in copy framework script.
8+
9+
There's no benefit from using dynamic framework on a private lib. So when static library for swift introduced in Xcode 9, we desperately want to adopt it for swift integration. Along with this plugin, cocoapods and xcode would statically link the libs and the problem is solved.
10+
11+
## So, what does the plugin patch exactly?
12+
13+
Cocoapods supports static framework in v1.4, but doesn't handle 2 things well:
14+
- It only supports static framework at pod level, means an option in podspec and just valid for that pod.
15+
- Static swift framework target doesn't copy the generated header file of swift to the framework. So objc code can't import and use swift code.
16+
17+
This plugin makes all pods to static frameworks and copies the missing header. To be precise, the aggregate target is still a dynamic framework. The main target of your app links one dynamic framework, who contains all the pods' code statically. This plugin doesn't modify cocoapods too much and the cost is acceptable. (100 pods project increase 120ms for dynamic linking in boot time)
818

919
## Usage
20+
Install via gem:
21+
22+
```
23+
$ gem install cocoapods-static-swift-framework
24+
```
25+
26+
Add the following to your podfile:
27+
28+
```ruby
29+
plugin 'cocoapods-static-swift-framework'
30+
static_frameworks
31+
32+
```
33+
34+
NOTE: Static frameworks is still using framework, not static library. So don't forget to add `use_frameworks!`
35+
36+
#### requirement
37+
- Xcode 9
38+
- cocoapods 1.4 ( tested on 1.4.0rc1 )
39+
40+
41+
42+
## License
43+
MIT
1044

11-
$ pod spec framework POD_NAME
45+
Appreciate a 🌟 if you like it. Another cocoapods plugin made by me [cocoapod-developing-folder](https://github.com/leavez/cocoapods-developing-folder)

0 commit comments

Comments
 (0)