How to Install an Earlier Version of a CocoaPod

I’ve only used CocoaPods to level up to the latest version of whatever library I’m using. However, now with Swift support, I’ve found that I have to use a previous version of a CocoaPod because I’m still using an earlier version of Swift in my project.

For example, Quick has already released a Swift 2.0 – compatible version, but if you have a Swift app in production, you can’t upgrade to it yet! Yet, you might need to upgrade from Swift 1.1 to Swift 1.2.

Finding and installing the correct version of a CocoaPod is simple (once you know how to do it of course!):

1. Find your pod on – here is Quick
2. Go to the pod’s Github page

cocoapods quick github

3. Select the releases tab

Quick Releases Swift

4. Now you can read the release notes to figure out which version is the latest for the Swift version you need in your project. Hopefully the library maintainers made that clear!

Quick Releases

5. Install the correct version of the pod using the release tag version! So for Quick with Swift 1.2 you would add the following to your pod file:

pod 'Quick', '0.3.1'

If anyone knows of a better / easier way to do this, let me know in the comments. Enjoy CocoaPods with Swift!

Enjoy the article? Join over 14,500+ Swift developers and enthusiasts who get my weekly updates.

  • andreamazz

    Hi. It might be worth mentioning that if a pod follows semantic versioning you can use the optimistic operator ~> to pull down minor non-breaking fixes that can be released in the future. So you can specify:
    pod ‘Quick’, ‘~> 0.3’
    This way if a critical fix is released in version 0.3.2, Cocoapods can safely download it without changing the Podfile. The Cocoapods guide covers this thoroughly:

    • Xavi Matos

      agreed, though semantic version sort of break downs when a project is being cautious about claiming that something is a 1.0
      i also imagine that anything below 1.0 is actually shifting the meaning of the numbers over by one, where a change from 0.3 to 0.4 is a major, pre-stable change.
      specifying ‘~> 0.3.1’ as you did seems to reflect this thinking