CocoaPods
Hai Feng Kao

CocoaHead Taipei 2016.10
iOS Tech Challenge 2015.09
iOS Tech Challenge 2015.09
iOS
iOS iOS iOS iOS Firmware
MERGE!!! xcodeproj
MERGE!!! xib
MERGE!!! storyboard
2016 Hack NTU 2016.08
2016 Hack NTU 2016.08
iOS iOS
iOS
iOS
iOS
iOS iOS
Ruby
Development Pods!
sudo gem install cocoapods
Let CocoaPods manage files
• Don’t use xcodeproj

• Use xcworkspace instead

• don’t commit xcworkspace

• put it in .gitignore

• Put files in development pods

• New files will be added to xcworkspace

• run pod install when files are added or removed

• don’t have to run pod install for file editing

• Regenerate xcworkspace after each pull

• by running pod install again
•
• enable demo application
Create new project
Ignore xcworkspace
Ignore Pods
Add new files
• Put sources in HelloWorld/Classes
• Arrange the code structure
• Different folder for different iOS dev
• Or any way you like
Create xcworkspace
• run pod install
Images!
enable bundles
• uncomment resource_bundles

• in HelloWorld.podspec

• include all files in Assets

• storyboard

• xib

• jpg

• png
Add PodAsset
• We need it to locate bundles

• https://github.com/
haifengkao/PodAsset
Show appreciation
• Press 

• https://github.com/
haifengkao/PodAsset
Add images
• to HelloWorld/Assets
Show images
• locate the bundle with
PodAsset

• use imageNamed:inBundle:
Other resources
• You can use the same method
to load

• json

• storyboard

• xib

• Check readme

• https://github.com/
haifengkao/PodAsset

• Send you pull requests!
Clean git repository
• No more merges!!!!!
Summary
• Avoid merge xcodeproj
• put files in Classes folder
• Avoid merge xib and storyboard
• each dev maintains his own storyboard files
• put resources in Assets folder
Q&A
• You can mix swift and objc in the same pod
• The pod is local (development pod)
• you don’t have to publish it to the Internet
• This method didn’t cover test case management
• yes, you still need to merge xcodeproj if you add new
test cases
• There are other options: use frameworks instead of pods
Thank You

Cocoapods多人協做