Hey, alguma vez já se pegou na dúvida de quais são as diferenças entre o Cocoapods e o Carthage? Então, nessa palestra vamos aprender a usar cada uma delas para gerenciar as dependências dos nossos projetos, bem como contribuir com a comunidade utilizando as duas ferramentas para distribuir bibliotecas que nós construimos! Bora? :)
7. Instalação:
No terminal:
# Xcode 7 + 8
$ sudo gem install cocoapods --pre
# Xcode 7
sudo gem install activesupport -v 4.2.6
sudo gem install cocoapods
O CocoaPods é escrito em Ruby e a equipe do CocoaPods recomenda que você utilize o Ruby
default do OSX
9. Sobre o Podfile:
platform :ios, '8.0' // Versão mínima do iOS que o projeto dará suporte.
use_frameworks! // Necessário para compilar bibliotecas escritas em Swift.
target 'MyApp' do // Target do projeto que irá usar as bibliotecas
pod 'AFNetworking' // Nome da biblioteca.
pod 'ORStackView', '~> 3.0' // Nome da biblioteca e especificação de versão
pod 'SwiftyJSON', :git => 'https://github.com/
SwiftyJSON/SwiftyJSON.git', :branch => 'dev' // Nome e especificação da Branch
end
16. Sobre o Podspec:
Pod::Spec.new do |s|
s.name = 'MapChoices'
s.version = '0.1.0'
s.summary = "A simple iOS library that let users choose which
navigation should the app open."
s.description = "A simple iOS library that let users choose which
navigation should the app open. With just one method call, you show
a UIActionSheet with all the installed map Apps in the user's phone."
s.homepage = 'https://github.com/OpenCraft/MapChoices'
# s.screenshots = 'www.example.com/screenshots_1'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Cleber' => 'cleberhenriques@ilegra.com' }
s.source = { :git => 'https://github.com/OpenCraft/MapChoices.git',
:tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '8.0'
s.source_files = 'MapChoices/Classes/**/*'
end
21. Sobre o Cartfile:
github "ReactiveCocoa/ReactiveCocoa" >= 2.3.1 # Requer no mínimo versão 2.3.1
github "Mantle/Mantle" ~> 1.0 # (1.0 ou maior, porém menor que 2.0)
github "jspahrsummers/libextobjc" == 0.4.1 # Exatamente a versão 0.4.1
github "jspahrsummers/xcconfigs" # Usar sempre a ultima versão disponível
github "jspahrsummers/xcconfigs" "branch" # Use the latest version
# Use a project from GitHub Enterprise
github "https://enterprise.local/ghe/desktop/git-error-translations"
# Use a project from any arbitrary server, on the "development" branch
git "https://enterprise.local/desktop/git-error-translations2.git" "development"
git "file:///directory/to/project" "branch" # Use a local project