Managing iOS dependencies

  • Prefer to use Carthage for managing iOS library dependencies.
  • Use CocoaPods gem to manage dependencies only when needed dependency cannot be added with Carthage.
  • Use Bundler for managing tools (fastlane, cocoapods).

Updating dependencies

  • Update pods in the beginning of each month. Do not update pods if a release is scheduled soon.
  • Update fastlane before each release.

Best practices

  • Favor dependencies written in Swift. If you need to use ObjC dependencies, group them at the bottom of Cartfile or Podfile.

Best practices for using Carthage

  • Install Carthage using Homebrew: brew install carthage.
  • We don’t check in Carthage/Checkouts directory into git repository.
  • We don’t check in Carthage/Builds directory into git repository.
  • We check in other files managed by Carthage into git repository.
  • We use build command with --cache-builds option to build Carthage dependencies. This will prevent unnecessary recompilation of dependencies:
carthage bootstrap --cache-builds --platform iOS,watchOS

Best practices for using CocoaPods

  • Do not use inhibit_all_warnings!. Use inhibit_warnings only for pods which have compile warnings.
  • When the same pods are used by several targets of your project, move them out to a separate method.
  • We check in all the files managed by CocoaPods: workspace, Podfile, Podfile.lock and Pods directory into git.
def ios_pods
  platform :ios, '10.0'
  pod 'Alamofire'
end

target 'MyAppPlus' do
  ios_pods
end

target 'MyApp' do
  ios_pods
end