What is Carthage
Dependency management tool
• Written in Swift
• ReactiveSwift (not RxSwift)
https://github.com/Carthage/Carthage
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 2
Slide 3
Slide 3 text
What can Carthage do for me
• Fetch depedencies
• Resolve dependecies
• Build dependecies
• Copy dependencies in appropriate places
• Won't touch your project files
From here on, you're on your own.
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 3
Cartfile.private
Put dependecies you don't want to pass on here
github "swisspol/GCDWebServer" ~> 3.2
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 8
Slide 9
Slide 9 text
Using Dependencies
• Drag and drop them in your project
• Add Run Script Phase
carthage copy-frameworks
Add Inputs & Outputs to the copy-frameworks script
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 9
Slide 10
Slide 10 text
Pin your depedendencies
If you don't, Carthage will match anything
• At the mercy of the maintainers of your dependencies
• Undecidable tags
• Conflicting versions
Don't do this
binary "https://raw.githubusercontent.com/Building42/Specs/master/Carthage/Fabric.json"
github "BranchMetrics/ios-branch-deep-linking"
github "intercom/intercom-ios"
github "CocoaLumberjack/CocoaLumberjack"
github "evsinev/BerTlv"
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 10
Slide 11
Slide 11 text
New resolver
Carthage hangs indefinitely? !
Uses too much memory? "
• --new-resolver
• Check your Cartfile !
• Best to pin versions (avoid surprises) ~> x.y.z
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 11
Slide 12
Slide 12 text
Less rebuilds
Save time! ⏱
Avoid rebuilding dependencies
• --cache-builds
• use a cache for cold starts (Rome)
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 12
Slide 13
Slide 13 text
DSYMs & Debug Symbols
• Carthage will produce .dSYMs
• Binaries include debug symbols by default
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 13
Slide 14
Slide 14 text
Smaller binaries
Reduce the size of your app by enabling
• COPY_PHASE_STRIP=YES (defaults to no)
• carthage copy-frameworks will do the rest
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 14
Slide 15
Slide 15 text
Outdated depedencies
Carthage has you covered!
To Build Phases ➕ a new Run Script Phase
• carthage outdated --xcode-warning
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 15
Slide 16
Slide 16 text
Update just one dependecies
carthage update X
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 16
Slide 17
Slide 17 text
New version faster
A fix to your problem just got merged?
• brew upgrade carthage --HEAD
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 17
Slide 18
Slide 18 text
Still having issues?
Maintainers would ❤ if you
• Searched the existing issues before
• Filled in as much details as you can
• Provided a sample project (zip)
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 18
Slide 19
Slide 19 text
Thanks!
Thanks to all contributors that made this possible!
• Pull request always welcome!
• Very easy to get started!
• hack, pr, comments, repeat, merged! ✅
Tommaso Piazza @tmpz - UIKonf Unconference 16/05/2018 19