Carthage

 Carthage

Talk from NSLondon about the Carthage Dependency Management system for Xcode

F28c4835c9e2277b6e04b86574532a2d?s=128

Abizer Nasir

July 30, 2015
Tweet

Transcript

  1. Carthage Abizer Nasir | @abizern | abizern.org

  2. Yet Another Dependency Manager

  3. Developed after Swift and framework support in iOS

  4. Getting Carthage 4 https://github.com/Carthage/Carthage/releases (pre-built) or 4 brew update &&

    brew install carthage 4 You may need to tweak xcode-select
  5. What Does it do? 4 Takes a list of dependencies,

    that may have their own dependencies 4 Resolves versions 4 Fetches the dependencies 4 builds them with their own project settings
  6. That’s it! The rest is up to you!

  7. Your Job 4 Link the frameworks to the correct target

    4 Add a workaround script
  8. Cartfile github “ReactiveCocoa/ReactiveCocoa” >= 2.3.1 github “Mantle/Mantle” ~> 1.0 github

    “jspahrsummers/libextobjc” == 0.4.1 #arbitrary server git “https://enterprise.local/desktop/git-error-translations.git” “development” #local file git “file:///directory/to/project” “branch”
  9. Normal Semantic versioning 4 >= 1.0 for “at least version

    1.0” 4 ~> 1.0 for “compatible with version 1.0” 4 == 1.0 for “exactly version 1.0” 4 “some-branch-or-tag-or-commit” for a specific Git object (anything allowed by git rev-parse)
  10. Cartfile.private Same format as the Cartfile. Dependencies that your project

    needs that aren’t necessary for it to be used. These are not shared upstream. For example; things you need for testing.
  11. Demo Using Carthage

  12. carthage update Resolves dependencies and builds them

  13. carthage help update [--configuration Release] the Xcode configuration to build

    (ignored if --no-build option is present) [--platform all] the platform to build for (ignored if --no-build option is present) [--verbose] print xcodebuild output inline (ignored if --no-build option is present) [--no-build] skip the building of dependencies after updating [--use-ssh] use SSH for downloading GitHub repositories [--use-submodules] add dependencies as Git submodules [--no-use-binaries] check out dependency repositories even when prebuilt frameworks exist (ignored if --no-build option is present) [--color auto] whether to apply color and terminal formatting (one of ‘auto’, ‘always’, or ‘never’)
  14. carthage bootstrap Uses Cartfile.resolved to build dependencies

  15. carthage build Just builds what you have already. This is

    useful if you are using submodules.
  16. Demo Writing a Framework for Carthage

  17. Writing modules 4 Share your build schemes 4 When writing

    a Foundation module, create a separate target for iOS and Mac (takes some tweaking, but it can be done).
  18. !

  19. When things go wrong Because they will! - Check what

    compiler you are using with xcode-select -p - fix your build with carthage build --no-skip-current, build the scheme to see more detailed errors. - Blitz Carthage folder and Cartfile.resolved - Blitz the cache at ~/Library/Caches/carthage - Bitcode!
  20. When it all goes completely wrong! Because it will!

  21. When it all goes completely wrong! Because it will! -

    Change the Carthage update method to use submodules and not build. - Remove the linked frameworks. - Drag the dependency project files into your project and build it “old school”.
  22. So...

  23. None
  24. None
  25. Sorry!

  26. Simple

  27. Easy

  28. Carthage is simple, not easy. CocoaPods is easy, not simple.

  29. None
  30. Git

  31. Thank You Abizer Nasir | @abizern | abizern.org