Skip to content

Commit 9ec5e7b

Browse files
committed
update cocoapods pages
1 parent bc058c4 commit 9ec5e7b

File tree

3 files changed

+144
-3
lines changed

3 files changed

+144
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
|:----|:----|
5858
|iOS技能图谱/技术栈|[iOS技能图谱-byStuQ](./iOSNote/map-MobileDev-iOSDev.md) <br>[JSPatch作者博客中的技能栈-图](./images/iOS/iOSDev-bang.png)|
5959
|iOSDevNote|[**Dark Mode适配组件及Demo**](https://github.com/DevDragonLi/LFLDarkModeKit)<br>[**ProtocolService业务组件化Demo**](https://github.com/DevDragonLi/ProtocolServiceManger)<br>[**iOS开发架构分享文稿**](./iOSNote/iOS_architecture.pdf)<br>[**掘金客户端体积瘦身**](./iOSNote/iOSAppThin.md)<br>[**iOSDevCodeRepo**](https://github.com/DevDragonLi/iOSDevDemo)<br>[Core Animation框架结构及性能调优11张大图详解](https://github.com/DevDragonLi/Core-AnimationPerformanceOptimization)<br>[iOS_StaticLibrary](./iOSNote/iOS_StaticLibrary.md)<br>[iOS经典Crash分析与总结- QQ`MelonTeam`](https://github.com/DevDragonLi/iOSDevDemo)<br>[iOS核心动画高级技巧阅读笔记(**性能调优**,**高效绘制**,**图像IO**,**图层性能**)](./iOSNote/iOSCoreAnimationNote.md)<br>[单元测试概述](./iOSNote/UnitTesting.md)<br>[iOS_Article_List](./iOSNote/iOS_Collection_article_List.md)|
60-
|CocoaPods 相关 |<br>[**cocoapods-plugins集合**](./iOSNote/CocoaPods/cocoapods-plugins.md)<br>[提交开源框架之流程](./iOSNote/CocoaPods/cocoapods-podspec.md)<br>[管理库的使用技巧](./iOSNote/CocoaPods/CocoaPodsManageTips.md)<br>[提交私有的框架之流程](./iOSNote/CocoaPods/Pod&&spec.md)<br>[私有库参考Demo](https://github.com/DevDragonLi/iOSDevDemo/tree/master/1-DevDemo/PodPrivate_demo)|
60+
|CocoaPods 相关 |<br>[**cocoapods-plugins集合**](./iOSNote/CocoaPods/cocoapods-plugins.md)<br>[提交开源框架之流程](./iOSNote/CocoaPods/cocoapods-podspec.md)<br>[管理库的使用技巧](./iOSNote/CocoaPods/CocoaPodsManageTips.md)<br>[提交私有的框架之流程](./iOSNote/CocoaPods/Pod&&spec.md)<br>[私有库参考Demo](https://github.com/DevDragonLi/iOSDevDemo/tree/master/1-DevDemo/PodPrivate_demo)<br>[podspec](./iOSNote/CocoaPods/podspec.md)|
6161
|开源框架|**[WiFi显示图片高清图;蜂窝显示图片缩略图解析](./iOSNote/Analyze/SDWebImage/网络网络状态不同加载图片.md)**<br>**[MJRefresh源码解析](./iOSNote/Analyze/MJRefresh/MJRefresh.md)**|
6262

6363
## 欢迎提交 PR / issue

iOSNote/CocoaPods/Pod&&spec.md

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
- 读取涉及图片,需要处理对应的`@2`,`@3`
3232

3333

34-
3534
- **子库分离 参考 "AFN"**
3635

3736
`s.subspec 'LFLSegumentTool' do |b|
@@ -58,13 +57,71 @@ end`
5857

5958
- 指定多个子库
6059

60+
6161
```
6262
pod `LFLKit`,:subspec =>['base','LFLTool']
6363

6464
```
65-
6665

66+
- 如果您的Pods文件夹不包含在git中,则您可以添加keep_source_code_for_prebuilt_frameworks!Podfile的头部以加快Pod的安装速度,因为每次预建的Pod发生更改时,它都不会下载所有源代码。
67+
68+
- enable_bitcode_for_prebuilt_frameworks!
69+
70+
```
71+
要使用仓库的另一个分支:
72+
73+
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'dev'
74+
75+
要使用master仓库的分支:
76+
77+
pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git'
78+
79+
/// 指定固定源
80+
pod 'PonyDebugger', :source => 'https://github.com/CocoaPods/Specs.git'
81+
82+
pod 'QueryKit', :subspecs => ['Attribute', 'QuerySet']
83+
84+
pod "test",:head 一直最新
85+
86+
```
87+
88+
- Build configurations
89+
90+
```
91+
pod 'PonyDebugger', :configurations => ['Debug', 'Beta']
92+
93+
pod 'PonyDebugger', :configuration => 'Debug'
94+
95+
```
96+
97+
### generate_multiple_pod_projects
98+
99+
100+
- `install! 'cocoapods', generate_multiple_pod_projects: true`
101+
102+
- 多个兼容
103+
104+
```
105+
install! 'cocoapods',
106+
disable_input_output_paths: true,
107+
generate_multiple_pod_projects: true
108+
109+
```
110+
111+
```
112+
113+
post_install do |installer|
67114
115+
swift_4_0_compatible = [ ... ]
116+
swift_4_2_compatible = [ ... ]
68117
118+
installer.pod_target_subprojects.flat_map { |p| p.targets }.each do |t|
119+
t.build_configurations.each do |c|
120+
c.build_settings['SWIFT_VERSION'] = '4.0' if swift_4_0_compatible.include? t.name
121+
c.build_settings['SWIFT_VERSION'] = '4.2' if swift_4_2_compatible.include? t.name
122+
end
123+
end
124+
end
69125
126+
```
70127

iOSNote/CocoaPods/podspec.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
## PodSpec
2+
3+
> https://guides.cocoapods.org/syntax/podspec.html
4+
5+
- s.static_framework = true 是否是静态库 这个地方很重要 假如不写这句打出来的包 就是动态库 不能使用 一运行会报错 image not found
6+
7+
- spec.swift_version = '3.0', '4.0'
8+
9+
- spec.cocoapods_version = '>= 0.36'
10+
11+
- spec.prepare_command = 'ruby build_files.rb'
12+
13+
- spec.dependency 'AFNetworking', '~> 1.0', :configurations => ['Debug']
14+
15+
- spec.prefix_header_contents = '#import <UIKit/UIKit.h>', '#import <Foundation/Foundation.h>'
16+
17+
```
18+
spec.prefix_header_file = 'iphone/include/prefix.pch'
19+
spec.prefix_header_file = false
20+
21+
spec.module_name = 'Three20'
22+
23+
# 配置 Xcode Build Setting
24+
s.xcconfig = {
25+
'HEADER_SEARCH_PATHS' => '$(PODS_ROOT)/', # 配置 Header 搜索路径
26+
'FRAMEWORK_SEARCH_PATHS' => '$(PODS_ROOT)/', # 配置 Framwork 搜索路径
27+
'GCC_PREPROCESSOR_DEFINITIONS' => 'RELEASE COCOAPODS=1' # 配置预编译宏
28+
}
29+
```
30+
31+
### 匹配
32+
33+
- spec.source_files = 'Classes/**/*.{h,m}', 'More_Classes/**/*.{h,m}'
34+
35+
```
36+
* 将匹配所有文件
37+
c* 将匹配所有以开头的文件 c
38+
*c 将匹配所有以结尾的文件 c
39+
*c*将匹配其中所有文件c(包括开头或结尾)
40+
41+
```
42+
43+
```
44+
spec.ios.vendored_frameworks = 'Frameworks/MyFramework.framework'
45+
spec.vendored_frameworks = 'MyFramework.framework', 'TheirFramework.framework'
46+
47+
spec.ios.vendored_library = 'Libraries/libProj4.a'
48+
spec.vendored_libraries = 'libProj4.a', 'libJavaScriptCo
49+
50+
spec.ios.resource_bundle = { 'MapBox' => 'MapView/Map/Resources/*.png' }
51+
spec.resource_bundles = {
52+
'MapBox' => ['MapView/Map/Resources/*.png'],
53+
'MapBoxOtherResources' => ['MapView/Map/OtherResources/*.png']
54+
}
55+
56+
spec.resource = 'Resources/HockeySDK.bundle'
57+
58+
spec.resources = ['Images/*.png', 'Sounds/*']
59+
60+
spec.default_subspec = 'Core'
61+
spec.default_subspecs = 'Core', 'UI'
62+
spec.default_subspecs = :none
63+
64+
```
65+
66+
```
67+
Pod::Spec.new do |spec|
68+
spec.name = 'ShareKit'
69+
spec.source_files = 'Classes/ShareKit/{Configuration,Core,Customize UI,UI}/**/*.{h,m,c}'
70+
# ...
71+
72+
spec.subspec 'Evernote' do |evernote|
73+
evernote.source_files = 'Classes/ShareKit/Sharers/Services/Evernote/**/*.{h,m}'
74+
end
75+
76+
spec.subspec 'Facebook' do |facebook|
77+
facebook.source_files = 'Classes/ShareKit/Sharers/Services/Facebook/**/*.{h,m}'
78+
facebook.compiler_flags = '-Wno-incomplete-implementation -Wno-missing-prototypes'
79+
facebook.dependency 'Facebook-iOS-SDK'
80+
end
81+
# ...
82+
end
83+
84+
```

0 commit comments

Comments
 (0)