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 includes the GMSMapViewPublisher class which contains publisher properties that let you subscribe to events emitted by the map.

The following example configures a GMSMapViewPublisher instance to subscribe to camera change events:

let publisher = GMSMapViewPublisher(mapView: mapView)
publisher.didChangeCameraPosition.sink { cameraPosition in
  print("Camera position at \(cameraPosition.target)")
}

What's next