cocoa pods iosdevuk 14 talk: managing your libraries
DESCRIPTION
How to manage and organize your project using Cocoa pods, Synx, private pods, etc.TRANSCRIPT
![Page 1: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/1.jpg)
![Page 2: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/2.jpg)
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
![Page 3: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/3.jpg)
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!
![Page 4: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/4.jpg)
The$tradi*onal*$approach$to$library$managementlike%in%"tradi,onal"%==%bad
![Page 5: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/5.jpg)
• 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'
![Page 6: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/6.jpg)
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
![Page 7: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/7.jpg)
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
![Page 8: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/8.jpg)
![Page 9: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/9.jpg)
Talk%is%cheap.%Show%me%the%code.• Linus'Torvalds
![Page 10: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/10.jpg)
Install'Cocoa'Pods
The$easy$way:
$ sudo gem install cocoapods
Update'Cocoa'Pods
GOTO EASY_WAY
![Page 11: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/11.jpg)
A"pod"file
platform :ios, '7.0'
pod "AFNetworking", "~> 2.0"
pod "ARAnalytics", "~> 2.7"
![Page 12: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/12.jpg)
Create&pod&file
$ pod init
![Page 13: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/13.jpg)
Using&more&than&one&target?
platform :ios, "6.0"
target "SuperHeroes" do
end
target "SuperHeroesTests" do
end
![Page 14: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/14.jpg)
Final&pod&fileplatform :ios, "6.0"
target "SuperHeroes" do
pod 'AFNetworking', '~> 2.2'pod "NSLogger"
end
target "SuperHeroesTests" do
end
![Page 15: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/15.jpg)
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`.
![Page 16: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/16.jpg)
[!]$From$now$on$use$SuperHeroes.xcworkspace.
![Page 17: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/17.jpg)
[!]$From$now$on$use$SuperHeroes.xcworkspace.
![Page 18: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/18.jpg)
Duplicated+code!
Delete%duplicated%code...%Sweet!
![Page 19: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/19.jpg)
Change'imports
#import "NSLogger.h"
becomes:
#import <NSLogger.h>
![Page 20: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/20.jpg)
It#compiles#and#runBut$doesn't$run$tests
![Page 21: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/21.jpg)
link_with 'MainTarget', 'MainTargetTests'Move pods to common area 'MainTarget'
$ pod install
Because'StackOverflow
![Page 22: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/22.jpg)
Edit%Podfile%within%Xcode• even%install%Pods%using%Alcatraz%+%Cocoa%Pods%plugin
• Run%pod install%from%Xcode!
![Page 23: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/23.jpg)
Use$Groups,$please!• But%groups%alone%doesn't%suffice
• No%Finder%organiza7on
![Page 24: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/24.jpg)
Enter&Synx!• h#ps://github.com/venmo/synx
• Install9it:
$ sudo gem install synx
• Use%it
$ synx SuperHeroes.xcodeproj/
![Page 25: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/25.jpg)
Our$own$libraries$as$Pods
![Page 26: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/26.jpg)
You$need$two$things• Your&library&repo
• A&PodSpec,&inside&a&repo
Add#that#PodSpec#to#the#Cocoapods#specs
![Page 27: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/27.jpg)
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/
![Page 28: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/28.jpg)
Create&the&Spec
pod$spec$create$PrivateLibrary
Check&the&spec
pod$spec$lint$PrivateLibrary.podspec
![Page 29: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/29.jpg)
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]
![Page 30: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/30.jpg)
Check&our&newly&installed&spec!
cd ~/.cocoapods/reposcd MarvelAPIHelper/pod repo lint .
![Page 31: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/31.jpg)
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
![Page 32: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/32.jpg)
Review• CocoaPods:*best*tool*for
• 3rd*party*library*management
• conflict*/*dependencies*resolu;on
• stay*updated
• managing*your*own*libraries
![Page 33: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/33.jpg)
Thanks!Everything+was+crystal+clear,+so+no+ques5ons+
needed
Contact'/'send'beer:'@dfreniche
![Page 34: Cocoa pods iOSDevUK 14 talk: managing your libraries](https://reader033.vdocuments.us/reader033/viewer/2022060118/558b41b5d8b42a49668b4697/html5/thumbnails/34.jpg)
Links• h#p://cocoapods.org
• Private4pod4spec4repo:4h#ps://github.com/dfreniche/Private:CocoaPods
• Example4App4using4Pods4and4the4private4Pod:4h#ps://github.com/dfreniche/MarvelAPIHelper