Bore%Da!• Diego'Freniche
• @dfreniche
• I'develop'Apps
• also'teach'people'how'to'do'it
• iOS/Android/BB10/webOS/...
Ultra&geek*CV:*h/ps://github.com/dfreniche/cv
Warning!• This&talk&is&maybe&Dave&Addey&approved
• I'm&going&to&talk&about&lots&of&third&party&libraries,&specially&for&networking&code,&so&for$sure$is$not$Markus$Zarra$approved!
The$tradi*onal*$approach$to$library$managementlike%in%"tradi,onal"%==%bad
• write'your'code
• find'some'libraries'on'StackOverflow
• download'them'from'github
• unzip'&'add'to'your'project
• which%folder%do%I%have%to%add%to%my%project?
• try'to'keep'that'mess'organized
• ...'good'luck'with'that'
What%if...?• there's(a(new(version(of(your(libs(with(more(features?
• there's(a(fixed(bug(you(don't(know(about?
• GOTO$Tradi)onal$approach
Cocoa%Pods%light%introduc1on• Abstract
• The,idea
• The,Philosophy,behind,Cocoa,Pods
• Something,very,clever,here
• Are,you,s;ll,awake?
• Kill,by,PowerPoint
Slide&1&/&300
Talk%is%cheap.%Show%me%the%code.• Linus'Torvalds
Install'Cocoa'Pods
The$easy$way:
$ sudo gem install cocoapods
Update'Cocoa'Pods
GOTO EASY_WAY
A"pod"file
platform :ios, '7.0'
pod "AFNetworking", "~> 2.0"
pod "ARAnalytics", "~> 2.7"
Create&pod&file
$ pod init
Using&more&than&one&target?
platform :ios, "6.0"
target "SuperHeroes" do
end
target "SuperHeroesTests" do
end
Final&pod&fileplatform :ios, "6.0"
target "SuperHeroes" do
pod 'AFNetworking', '~> 2.2'pod "NSLogger"
end
target "SuperHeroesTests" do
end
Install'podspod install
Analyzing dependenciesDownloading dependenciesInstalling AFNetworking (2.3.1)Installing NSLogger (1.2)Generating Pods projectIntegrating client project
[!] From now on use `SuperHeroes.xcworkspace`.
[!]$From$now$on$use$SuperHeroes.xcworkspace.
[!]$From$now$on$use$SuperHeroes.xcworkspace.
Duplicated+code!
Delete%duplicated%code...%Sweet!
Change'imports
#import "NSLogger.h"
becomes:
#import <NSLogger.h>
It#compiles#and#runBut$doesn't$run$tests
link_with 'MainTarget', 'MainTargetTests'Move pods to common area 'MainTarget'
$ pod install
Because'StackOverflow
Edit%Podfile%within%Xcode• even%install%Pods%using%Alcatraz%+%Cocoa%Pods%plugin
• Run%pod install%from%Xcode!
Use$Groups,$please!• But%groups%alone%doesn't%suffice
• No%Finder%organiza7on
Enter&Synx!• h#ps://github.com/venmo/synx
• Install9it:
$ sudo gem install synx
• Use%it
$ synx SuperHeroes.xcodeproj/
Our$own$libraries$as$Pods
You$need$two$things• Your&library&repo
• A&PodSpec,&inside&a&repo
Add#that#PodSpec#to#the#Cocoapods#specs
git initgit add README.mdgit commit -m "Initial commit"git remote add origin https://github.com/dfreniche/Private-CocoaPods.gitgit push -u origin master
cd MarvelAPIHelper/0.0.1/
Create&the&Spec
pod$spec$create$PrivateLibrary
Check&the&spec
pod$spec$lint$PrivateLibrary.podspec
Add#repo#to#CocoaPods#list
pod$repo$add$MarvelAPIHelper$h0ps://github.com/dfreniche/Private>CocoaPods.git
Update'the'spec
pod$repo$update$MarvelAPIHelper
How$to$remove$a$Private$Repo
pod$repo$remove$[name]
Check&our&newly&installed&spec!
cd ~/.cocoapods/reposcd MarvelAPIHelper/pod repo lint .
Success!/usr/bin/pod install
Analyzing dependenciesDownloading dependenciesUsing AFNetworking (2.3.1)--> Installing MarvelAPIHelper (0.0.1)Using NSLogger (1.2)Using OCHamcrest (4.0.1)Using OCMockito (1.3.0)Using TPWeakProxy (1.0.0)Generating Pods projectIntegrating client project
Review• CocoaPods:*best*tool*for
• 3rd*party*library*management
• conflict*/*dependencies*resolu;on
• stay*updated
• managing*your*own*libraries
Thanks!Everything+was+crystal+clear,+so+no+ques5ons+
needed
Contact'/'send'beer:'@dfreniche
Links• h#p://cocoapods.org
• Private4pod4spec4repo:4h#ps://github.com/dfreniche/Private:CocoaPods
• Example4App4using4Pods4and4the4private4Pod:4h#ps://github.com/dfreniche/MarvelAPIHelper
Top Related