Starting with version 3.9.0, the Maps and Places SDKs for iOS now officially support the decentralized dependency manager, Carthage, for installing these SDKs into your apps.
Why support Carthage?
CocoaPods has been the leading package manager for third-party dependencies since the very early days of iOS development. Managing dependencies through CocoaPods is reliable and is arguably the fastest way to get started with integrating external libraries into your app. In fact, the Maps SDK has been available through CocoaPods since version 1.0.1 of the Maps SDK was released back in December 2012.
While CocoaPods provides ease-of-use, it requires recompiling and rebuilding your project’s dependencies on each clean build which can negatively affect your build speeds over time. This behavior may be undesirable which is why the Maps and Places SDK binaries are also distributed via .zip file so that you can have more granular control over your dependencies.
Carthage acts similar to pulling in dependencies manually into your project as Carthage dependencies are pre-built and do not require rebuilding your dependencies on each build. Additionally, through Carthage you can receive future version updates via the Carthage CLI command
How can I use Carthage to install the Maps or Places SDK?
First, create or update the Cartfile file in your project’s root directory with the following line:
If you are also using the Places SDK for iOS, add the following line to your Cartfile as well (even if you are only using the Places SDK for iOS you will also need to include the Maps SDK as it depends on it):
Once the files have been created, run the command
carthage update --platform ios to fetch the .framework files which you can then add to your project by linking the libraries to your application binary.
We recognize that developers have different needs and providing different integration mechanisms allows you to build apps in a way that makes the most sense for your use case. If you have any suggestions or feedback, we’d love to hear from you.
For more information on Google Maps Platform, visit our website.
Read More for the details.