Code Samples Overview

The SDK demo app supplied with the Maps SDK for iOS includes samples for the feature highlights of the SDK. In addition, you can find code snippets on each page of this developer's guide.

Try the SDK demos using CocoaPods


The Maps SDK for iOS supplies an SDK demo app that you can install and run using the pod try GoogleMaps command. Follow these steps to install CocoaPods and try the Maps SDK for iOS.

    sudo gem install cocoapods

    Use files from GitHub

    2. Open a terminal window, navigate to the directory where you expanded the sample files, and drill down into the GoogleMaps directory:
      cd maps-sdk-for-ios-samples-master/GoogleMaps
    3. Run the following commands:
      pod install
          open GoogleMapsDemos.xcworkspace

    Use CocoaPods v1.6.1

    1. Open a terminal window and install version 1.6.1:
      sudo gem install cocoapods -v1.6.1
    2. Fetch the Google Maps files using Cocoapods:
      pod try Google-Maps-iOS-Utils

      Choose either Swift or Objective-C when prompted. CocoaPods updates your spec repositories, then opens the demo in a temporary Xcode project named SwiftDemoApp.xcodeproj or ObjCDemoApp.xcodeproj.

  5. Edit the SDKDemoAPIKey.h file and paste your API key into the definition of the kAPIKey constant. For example:
    static NSString *const kAPIKey = @"YOUR_API_KEY";
  6. If Xcode prompts you to unlock the SDKDemoAPIKey.h file for editing, choose Unlock.
  7. Remove the following line, because it's used to register the user-defined issue:
    #error Register for API Key and insert here.
  8. Build and run the project. The iOS simulator window appears, showing a list of Maps SDK Demos.
  9. Choose one of the options displayed, to experiment with a feature of the Maps SDK for iOS.
  10. If prompted to allow GoogleMapsDemos to access your location, choose Allow.

Use code snippets from the developer's guide
