cocoapods私有组件如何组装到主工程中
target 'demoApp' do
# Pods for demoApp
pod 'Masonry'
pod 'YYModel'
#本地链接法- 方便时时调试,私有组件 K_Mine
#K_Mine 已经拉到本地了,所以使用本地link. 注意路径 .. 代表上一级文件夹
pod 'K_Mine', :path => '../K_Mine'
#直接pod法- 方便拉取K_Mine,前提是K_Mine功能已经完善不需要修改
#K_Mine 没有拉到本地,那就指定路径 及 branch
pod 'K_Mine', :git => 'ssh://git@gitlab.kk.com/lala/K_Mine.git', :branch => 'develop'
end
preprocessor macros 工程预编译宏
- 在主工程中 build settings - preprocessor macros 设置自己预编译宏,可以在整个工程里使用。
- 如果你的工程是由多个私有的pod组件构成,要在私有的组件中 预编译宏也能work,需要在podfile中最下面增加
target 'demoApp' do
# Pods for demoApp
pod 'Masonry'
pod 'YYModel'
pod 'K_Mine'
pod 'K_History'
end
## 这下面的配置是为了 K_MainTheme 宏 能在各个模块都能work,这样的话在K_Mine K_History 中的K_MainTheme 都是 K_MainTheme=1
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'K_MainTheme=1']
end
end
end