Slide 1

Slide 1 text

Managing&your&dependencies&using& CocoaPods&Carthage Cocoaheads)Montréal)02/2015

Slide 2

Slide 2 text

Why$do$we$need$a$new$dependency$ manager$for$iOS$/$OSX?

Slide 3

Slide 3 text

We#don't.

Slide 4

Slide 4 text

Thanks!

Slide 5

Slide 5 text

Dependency(management? Automa'ng*the*process*of*installing,* upgrading,*configuring,*and*removing*libraries

Slide 6

Slide 6 text

Cocoapods(VS(Carthage

Slide 7

Slide 7 text

Cocoapods!VS!Carthage • Ruby&based,&Centralized&repository,&kinda&intrusive • List&dependencies&in&a&“Podfile”,&share&your&libs&using&a&JSON& “podspec”&file • Framework&support&since&0.36 • AutomaKc&doc&generaKon&at&cocoadocs.org • PLUGINS&(ex:&github.com/orta/cocoapodsPkeys)!

Slide 8

Slide 8 text

Cocoapods!VS!Carthage h"ps:/ /github.com/search?u48=✓&q=filename%3APodfile

Slide 9

Slide 9 text

Cocoapods(is(s*ll(a(great(tool(and( you((probably)(don't(need(to(switch

Slide 10

Slide 10 text

Carthage • S#ll%really%fresh • Another%nice%tool%from%Github • (Painfully?)%wri

Slide 11

Slide 11 text

Cocoapods(VS(Carthage h"ps:/ /github.com/search?u48=✓&q=filename%3ACartfile

Slide 12

Slide 12 text

Ge#ng&started&with&Carthage • Visit&github.com/Carthage/Carthage • Go&to&releases&and&download&latest • Open&*.pkg&blahblahblah or ! ~ $ brew install carthage

Slide 13

Slide 13 text

Ge#ng&started&with&Carthage ! ~ $ carthage

Slide 14

Slide 14 text

Carthage(leverages(the(power(of(Frameworks • Available)on)OSX)since)~1977)(*reference)required) • Available)on)iOS)since)Facebook)and)Dropbox)figured)a)way)to) cheat • Available)on)iOS)since)iOS)8 • Frameworks)can)contain)a)lot:)Views,)Controls,)Resources)(cf) WWDC)#416)

Slide 15

Slide 15 text

A"basic"Cartfile Add#your#dependencies#(github#repo,#URL#to#git#repository)#into#a# Cartfile github "realm/realm-cocoa" == 0.90.3 github "Palleas/ReactiveCSVParser" "master"

Slide 16

Slide 16 text

Installing)/)Upda.ng)dependencies $ `carthage update` • Carthage)will)fetch)all)the)dependencies)in)the)Carthage/ Checkouts)folder)and)build)the)shared)schemes • A)Cartfile.resolved)that)you/have/to/commit)will)be)generated • Frameworks)will)be)generated)in)Carthage/Build,)simply)drag) them)in)your)project

Slide 17

Slide 17 text

Submodules*are*cool*again! $"carthage"update"!!use!submodules (Don't'worry,'Carthage'handle'the'hard'part'automagically)

Slide 18

Slide 18 text

I"have"been"using"Carthage"for"a"few"weeks" now

Slide 19

Slide 19 text

I"tested"it"with"a"CSV"parser"I"wrote github.com/Palleas/Reac2veCSVParser

Slide 20

Slide 20 text

Sharing(my(framework:(share(the(scheme

Slide 21

Slide 21 text

Sharing(my(framework:(tag(and(push! $ git tag 0.0.1 $ git push origin master --tags (Note&that&you&can&use&a&branch,&a&commit,&anything&git rev- parse&will&understand)

Slide 22

Slide 22 text

Adding&my&framework (Because(I(like(my(framework) $ echo 'Palleas/ReactiveCSVParser "~> 0.0.1"' >> Cartfile $ carthage update

Slide 23

Slide 23 text

Or#if#I#want#to#contribute... $ git clone [email protected]:Palleas/Catalog.git $ cd Catalog $ carthage bootstrap

Slide 24

Slide 24 text

Some%issues%I%got Adding&a&framework&with&no&shared&schemes *** Fetching realm-cocoa *** Checking out realm-cocoa at "b30" *** xcodebuild output can be found in /var/folders/qt/nys5f4b154x88ysnv0bccdbm0000gn/T/carthage-xcodebuild.uEWmAC.log Project "TightDbObjcDyn.xcodeproj" has no shared schemes

Slide 25

Slide 25 text

Project "TightDbObjcDyn.xcodeproj" has no shared schemes (Wat?)

Slide 26

Slide 26 text

Some%issues%I%got Using&Carthage&(well&actually,&it's&Frameworks)& in&a&command&line&tool (TL;DR:(It's(a(pain)

Slide 27

Slide 27 text

Con$nuous'Integra$on (Yes,&again.)

Slide 28

Slide 28 text

Se#ng&up&travis/ci Carthage(is(not(included(in(Travis3ci((yet?) #!/usr/bin/env bash echo "*********** Installing Carthage ***********" brew update brew install carthage --HEAD

Slide 29

Slide 29 text

Se#ng&up&travis/ci Carthage(will(build(all(your(schemes,(even(the(one(you( don't(need echo "*********** Installing dependencies with Carthage ***********" carthage bootstrap --no-build find Carthage/Checkouts -type f -name "*iOS*.xcscheme" -delete carthage build

Slide 30

Slide 30 text

Conclusion Carthage(is(great.(It(provides(less(features( than(Cocoapods(but(is(easier(to(use

Slide 31

Slide 31 text

Thanks! (Want&a&book?) (Photos'©'Camille'Furno'!)