Learning Objectives
-
Install cocoapods needed to complete Snacktacular
-
Learn how to check if cocoapods software or pods used in a given project need to be updated, and know how to update, if needed.
Video Lesson
Reference
How to Spot Cocoapods Software that Needs Updating and How to Update It
If you are working with cocoapods via commands in your Mac’s Terminal program and your cocoapods software is outdated, you should see a message stating something along the lines of:
CocoaPods X.X.X is now available, please update
This message is usually followed by instructions on how to update:
To update use: ‘sudo gem install cocoapods’
This is the same command that we used in an earlier lesson when we first installed the cocoapods gem software. Simply re-run this command in Terminal, and your cocoapods should update to the latest version. You can also check the version of cocoapods software that you are using via the Terminal command:
gem list cocoapods pod –version
Checking for outdated pods, and updating when needed
The individual pod files (think Alamofire, Swift JSON, GooglePlaces and not the Cocoapods gem) can also get out of date. These are not updated automatically because a version change in a software library could possibly change how your software runs. The pods that we run are very solid, but they do sometimes change syntax during major updates. You wouldn’t want to make a change that could break code unless you are ready to test the update – especially if others were working on the same project,
That said, it’s a good idea to use the latest version of pods because they often contain bug fixes. You can check to see if any of your pods are outdated by using the Terminal command:
pod outdated
This will scroll through a list of all of your pods, let you know if any are out of date, and indicate the current release version number. You can update all of your pods by using the Terminal command:
pod update
And you can update a single podfile using the command below, where PODFILE is the name of the pod you’d like to update:
pod update PODFILE
Checking for outdated pods, and updating when needed
Key Takeaway
-
When using terminal commands with cocoapods, always scan output to see if there are any updates to the main cocoapods gem software. If so, you’ll see a message like: CocoaPods X.X.X is now available, please update
-
This message is usually followed by instructions on how to update the software: To update use: ‘sudo gem install cocoapods’
-
To check if any individual pods need updating, use the terminal command: pod outdated
-
Update all pods that need an update with the command: pod update
-
You can update an individual podfile by replacing PODFILE with the name of the pod in the following command: pod update PODFILE
Exercises
There are no exercises for this section since the techniques using Google Places were covered in an earlier video lesson.