iOS组件化开发实战记录

2020-01-21 07:54:41王振洲

1、Create Component Project


pod lib create ProjectName

2、Use Git


echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://www.easck.com/pre>

3、Edit podspec file


vim CoreLib.podspec

Pod::Spec.new do |s|
 s.name  = '组件工程名'
 s.version  = '0.0.1'
 s.summary  = 'summary'

 s.description = <<-DESC
 description
   DESC

 s.homepage  = '远程仓库地址'
 s.license  = { :type => 'MIT', :file => 'LICENSE' }
 s.author  = { '作者' => '作者' }
 s.source  = { :git => '远程仓库地址', :tag => s.version.to_s }

 s.ios.deployment_target = '8.0'

 s.source_files = 'Classes/**/*.{swift,h,m,c}'
 s.resources = 'Assets/*'
 
 s.dependency 'AFNetworking', '~> 2.3'
end

4、Create tag


//create local tag
git tag '0.0.1'
或
git tag 0.0.1

//local tag push to remote
git push --tags
或
git push origin 0.0.1

//delete local tag
git tag -d 0.0.1

//delete remote tag
git tag origin :0.0.1

5、Verify Component Project


pod lib lint --allow-warnings --no-clean

6、Push To CocoaPods


pod repo add CoreLib git@git.test/CoreLib.git
pod repo push CoreLib CoreLib.podspec --allow-warnings

4. 模块拆分

iOS,组件化开发