Combine Library

Combine is a framework for handling asynchronous events by combining event-processing operators. Combine makes your code easier to read and maintain by centralizing your event-processing code.

The GoogleMapsPlatformCombine library is a Swift library that returns Publishers for the Maps SDK for iOS and Places SDK for iOS so that you can take advantage of the rich set of Combine features.

Installation

See the GoogleMapsPlatformCombine library documentation on GitHub for the latest system requirements and installation instructions.

Example Usage

The GoogleMapsPlatformCombine library provides extensions to the GMSPlacesClient class which return Future publishers for Places API calls.

The following example uses the fetchPlace(id:, fields:, sessionToken:) -> Future<GMSPlace, Error> extension to fetch place details:

GMSPlacesClient.shared()
  .fetchPlace(
    id: "placeId",
    fields: [.placeID, .name, .phoneNumber]
  )
  .sink { completion in
    print("Completion \(completion)")
  } receiveValue: { place in
    print("Got place \(place.name ?? "")")
  }

What's next