cocoaheads rennes #13 : cocoapods
Post on 28-May-2015
3.254 Views
Preview:
DESCRIPTION
TRANSCRIPT
The best way to manage library dependenciesin Objective-C projects.
CocoaHeads Rennes #13
Thomas Dupont
Septembre 2013
CocoaPods
Introduction
avant• Fichiers sources en vrac• Pas moyen d’avoir de la conf pour le composant• On ne sait plus en quelle version est notre composant• On ne sait pas si il y a des mises à jour de nos composants• Temps de configuration
maintenant
sudo gem install cocoapods
pod setup
Installation
platform :ios, '5.0'xcodeproj 'Demo/Demo'
pod 'AFNetworking'pod 'STCollapseTableView'
pod install
Utilisation
version x.y.z
UtilisationSemantic
Versionning
pod 'AFNetworking', '1.3.1' 1.3.1pod 'AFNetworking', '~> 1.3.1' 1.3.2pod 'AFNetworking', '~> 1.3' 1.3.2pod 'AFNetworking' 2.0.0-RC3
x = version majeurey = version mineurez = patch
pod update
pod search debugkit
Utilisation
platform :ios, '5.0'xcodeproj 'Demo/Demo'
pod 'AFNetworking', '~> 1.3'
target :DemoTests do pod 'OCMock', '~> 2.2' pod 'OHHTTPStubs', '~> 2.0'end
Utilisation
https://github.com/CocoaPods/Specs
Pod::Spec.new do |s| s.name = "MyComponent" s.version = "1.2.3" s.summary = "A summary." s.description = <<-‐DESC A larger description. DESC s.homepage = "https://github.com/pathToMyComponent" s.license = 'MIT' s.author = { "Author" => "my@mail.com" }
s.source = { :git => "https://github.com/pathToMyComponent.git", :tag => s.version.to_s } s.platform = :ios, '5.0'
s.source_files = 'MySourceFiles/*.{h,m}'
s.framework = 'Foundation', 'QuartzCore' s.requires_arc = trueend
pod spec lint myComponent.podspec
pod spec create
Créer un composant
~/.cocoapods/repos
Créer un composant
pod 'MyComponent', :path => '../Components/MyComponent'
pod 'MyComponent', :git => 'https://github.com/pathToMyComponent.git'
platform :ios, '5.0'xcodeproj 'Demo/Demo'
pod 'STDebugKit'
platform :ios, '5.0'xcodeproj 'Demo/Demo'
pod 'STDebugKit/CoreData'
=> Dépendance vers MagicalRecord
Subspec
Références• CocoaPods• http://cocoapods.org/
• http://docs.cocoapods.org/
• https://github.com/CocoaPods/Specs/wiki
• Composants• https://github.com/AFNetworking/AFNetworking
• https://github.com/magicalpanda/MagicalRecord
• https://github.com/iSofTom
• https://github.com/AliSoftware
• http://ocmock.org/
top related