pod組件化,swift,objective-c混合開發
pod 組件化管理
-
創建swift工程(PodSwift)
-
創建objective-c工程(httpmanager)
-
進入工程目錄下創建spec
pod lib create PodSwift
填寫提示信息,然後創建需要暴露調用的類所有的swift類
s.source_files = 'PodSwiftLibs/**/*.swift'
swift objective-c混合開發
編譯問題查看 https://www.jianshu.com/p/c7623c31d77b
pod注意事項
-
local pod 引用 pod庫
s.dependency "Masonry"
-
引用預處理宏定義
local pod庫中調用masonry中簡寫方法需要在spec申明:
#pod中的macro
s.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'MAS_SHORTHAND=1 MAS_SHORTHAND_GLOBALS=1'}
#項目中的macro
s.user_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'MAS_SHORTHAND=1 MAS_SHORTHAND_GLOBALS=1'}
git:demo地址