iOS, Bazel and Google Maps & Google Places

If you need to use Google Maps in your iOS application and you are using Bazel.build to build it, then this configurations I used may save you some time.

I solved in three steps:

  • Add remote http archives.

The WORKSPACE file need the following lines. Of course, if you are not using Google Places, you can remove the corresponding lines.

WORKSPACE

As you can see, the build_file parameter points to the BUILD file that will need to be executed to register the libraries within Bazel to be able to add them as target dependencies of the swift libraries you will want to develop.

The first one, GoogleMaps/BUILD looks like this:

GoogleMaps/BUILD

The GoogleMaps static import needs to reference the frameworks mentioned in Google Maps documentation (https://developers.google.com/maps/documentation/ios-sdk/start?hl=es)

The second BUILD, for Google Places looks like this:

GooglePlaces/BUILD

To build a Swift library using the Google Maps and Google Places SDKs, is a simple as you can see below:

BUILD

You can see in the previous code how we are referencing Google Maps and Google Places using the corresponding labels in de deps attribute.

And with these snippets, you will be able to compile, for instance, the demo code provided by Google:

I hope this suggestions help you save some time when trying to integrate Google Maps in you Bazel built iOS application.

--

--

Engineer, Google Developer Expert , co-founder of Adesis Netlife and Kenobi Ventures. CTO @ GFT Group

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gonzalo Ruiz de Villa

Engineer, Google Developer Expert , co-founder of Adesis Netlife and Kenobi Ventures. CTO @ GFT Group