iOS, como usar o GMSCoordinateBounds para mostrar todos os marcadores do mapa?

Quero mostrar todos os marcadores que estão no meu mapa, depois de fazer algumas pesquisas, achei que deveria ser feito comGMSCoordinateBounds (SDK do Google Maps) Li a documentação oficial sobre o assunto, mas não entendi como usá-lo e implementá-lo no meu código.

https://developers.google.com/maps/documentation/ios/reference/interface_g_m_s_camera_update#aa5b05606808272f9054c54af6830df3e

Aqui está o meu código

GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] init];   
CLLocationCoordinate2D location;

for (NSDictionary *dictionary in array) {
    location.latitude = [dictionary[@"latitude"] floatValue];
    location.longitude = [dictionary[@"longitude"] floatValue];

    // Creates a marker in the center of the map.
    GMSMarker *marker = [[GMSMarker alloc] init];
    marker.icon = [UIImage imageNamed:(@"marker.png")];
    marker.position = CLLocationCoordinate2DMake(location.latitude, location.longitude);
    bounds = [bounds includingCoordinate:marker.position];
    marker.title = dictionary[@"type"];
    marker.map = mapView_;
}   

[mapView_ animateWithCameraUpdate:[GMSCameraUpdate fitBounds:bounds withPadding:30.0f]];

Qualquer ajuda ?

questionAnswers(9)

yourAnswerToTheQuestion