Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoapods vs Gradle - iOS

Currently I am trying to figure out how to use Cocoapods. Many blogs quoted that Cocoapods is the best dependency management tool at present.

However, I am also using Gradle plugin for building my application.

Now the question is, can Gradle do the same dependency management for my private files & libraries (.a files) as Cocoapods.

like image 336
footyapps27 Avatar asked Mar 03 '14 10:03

footyapps27


People also ask

What is the equivalent of Gradle in iOS?

The Xcode Plugin generate files that are used by the Xcode IDE to open Gradle projects into Xcode ( File - Open… ​ ).

Can Gradle be used for iOS?

If you are new to iOS and/or Xcode you should probably not use a mixture of Gradle and Xcode as it adds extra complexity to an already complex build environment. If you are familiar with Gradle and you also (!) have some knowledge of Xcode, then I would recommend to use Gradle.

What is CocoaPods used for?

CocoaPods is an application level dependency manager for Objective-C, Swift and any other languages that run on the Objective-C runtime, such as RubyMotion, that provides a standard format for managing external libraries.

What is iOS dependency manager?

A package/dependency manager can be said as a tool that automates the process of installing, upgrading, configuring, removing software in our application. Let's assume we need to handle network requests inside our app, but we don't want to waste our time in creating something that already exists.


1 Answers

Long story short (Jan. 2015):

  • Gradle: build system + dependency management.
  • Cocoapods: dependency management for Xcode internal builds.

There is probably more to this (for others that want to start commenting "but Cocoapods can also.."), but for a start that summarises it.

If you are new to iOS and/or Xcode you should probably not use a mixture of Gradle and Xcode as it adds extra complexity to an already complex build environment. If you are familiar with Gradle and you also (!) have some knowledge of Xcode, then I would recommend to use Gradle. Advantage? You have full control over your builds and it saves you from messing around in endless Xcode build-config-dialogs. On top you gain access to other repositories (maybe not that interesting for you) AND you can script your builds in a cross-platform environment. I also use a non-MacOS build server (Linux+Jenkins) which is able to interpret Gradle-build scripts, which is another plus.

If you want access to a versioning system other than git, you also gain access to that... when I type the lines right here, I wonder why I ever built an app without Gradle :-). I have even more things that come to my mind, now that I think about it: mixed programming-language builds (Java/C#/objC...), unit-test integration that does not require Xcode, easy reuse of build configurations from project to project ... .

like image 151
Peter Branforn Avatar answered Oct 12 '22 05:10

Peter Branforn