CocoaPods is a dependency manager used in iOS development written in Ruby. I wanted to investigate how CocoaPods leveraged the advantages of Ruby and pre-existing ruby projects to become one of the essential parts of the iOS development workflow.
CocoaPods is a dependency manager for Cocoa and Cocoa Touch projects which covers macOS, iOS, watchOS and tvOS development. It is written in Ruby and distributed through RubyGems.
How popular is it?
According to the official website, CocoaPods has over 59 thousand libraries and is used in over 3 million apps. The gem has been downloaded more than 25 million times. Although the Swift Package Manager is gaining momentum as a first-party tool, CocoaPods is still the most popular way to distribute Swift and Objective-C code.
According to the creator Eloy Durán:
1. Duck typing and monkey patching
Ruby's duck typing and monkey patching make it easier for developers to customize CocoaPods to their projects. This helped a lot in the early phase of CocoaPods development when it was not able to cover all of the different cases. If CocoaPods was in Swift or Objective-C and compiled in binary, it would have been very hard to be extended freely.
CocoaPods uses bundler to parse dependency versions and RubyGems's infrastructure for distribution.
3. Creator's experience
Eloy had been using Ruby to write Cocoa apps so he was comfortable to write ruby code modifying Xcode projects.
Expanding the boundaries
At the time when Eloy started CocoaPods, many factors led Eloy to choose Ruby. Among them, the most interesting one for me is his familiarity with Ruby while developing macOS apps which are seemingly in different fields. He noticed the problem of missing dependency management and solved the problem with the best tool in his hands. If he was trying to make CocoaPods with Objective-C, it might take much longer and effort for it to be as popular as it is today.
I think it is also important to make time to learn and try different languages and frameworks outside of one's field and language. They can be used directly or indirectly. For example, the foundation concept of Swift UI is not invented with it but inspired by React. Under the umbrella of software development, we are dealing with similar problems just on different platforms. So why not look around how others are approaching them?