Site icon Ryadel

How to update your CocoaPod (when you forgot how to do it)

imageNamed non valido (e altri problemi con i resource files) dopo la creazione di un CocoaPod

CocoaPod is wonderful but, let's just face it, their documentation sucks. The whole guide website is mostly inaccurate and implies you already have an extensive know-how of their interface and terminology, which tend to be unfriendly and differ from almost any other developer environment, be it linux, windows or even mac. Hence why there is a recurring scenario, for me at least, when I have to create a new Pod - or update my existing one - and I simply cannot remember how to effectively do that. Not even a clue. Not at all.

That's why I resolved to write it down, at least for the update process. Here it is, hoping to save someone else's day other than mine.

  • Hop to your favorite (virtualized) Mac.
  • Perform a Pull of your project from your GitHub or BitBucket repo to your local repo, just to be sure to retrieve any possible change made from the web interface (merged pull requests, etc.).
  • Open XCode and perform all the code changes you need to do using your local file, issuing zero, one or more local Commits along the way.
  • When you're done, update the .podspec file increasing the s.version  number, for example from 1.11 to 1.12.
  • Test your build by opening a cmd shell, navigate to your CocoaPod's main folder and type: pod lib lint
  • Perform a final Commit to your local, non-GitHub repo with your latest changes (including the previous one in the .podspec file).
  • Right after the local Commit, assign a tag identical to the the s.version  number (1.12 in our example).
  • Synchronize/Push everything to your GitHub repo.
  • Shell to cmd, navigate to your CocoaPod's main folder and type: pod trunk push NAME.podspec

Bingo.

If only I could remember all this for more than 3 hours, I'll be even more happy.

Exit mobile version