From ae8bc6abd5c3e739fdc210d22839aeb038650281 Mon Sep 17 00:00:00 2001 From: Amrith Vengalath Date: Thu, 29 Aug 2024 10:41:23 +0530 Subject: [PATCH] Use viewportInfo instead of viewport [Places SDKs for iOS will no longer support the viewport property of GMSPlace objects.](https://github.com/tolu360/react-native-google-places/issues/293#issue-835946815) Starting with version 5.0 of the Google Maps Platform Places SDK for iOS, the viewport property of GMSPlace objects will be replaced with a property named viewportInfo of a new class type. --- ios/NSMutableDictionary+GMSPlace.m | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ios/NSMutableDictionary+GMSPlace.m b/ios/NSMutableDictionary+GMSPlace.m index bd37cf1..86fa25a 100644 --- a/ios/NSMutableDictionary+GMSPlace.m +++ b/ios/NSMutableDictionary+GMSPlace.m @@ -48,15 +48,15 @@ + (instancetype)dictionaryWithGMSPlace:(GMSPlace*)place placeData[@"rating"] = [NSNumber numberWithDouble:place.rating]; } - if (place.viewport) { - NSMutableDictionary *viewportMap = [[NSMutableDictionary alloc] init]; - viewportMap[@"latitudeNE"] = [NSNumber numberWithDouble:place.viewport.northEast.latitude]; - viewportMap[@"longitudeNE"] = [NSNumber numberWithDouble:place.viewport.northEast.longitude]; - viewportMap[@"latitudeSW"] = [NSNumber numberWithDouble:place.viewport.southWest.latitude]; - viewportMap[@"longitudeSW"] = [NSNumber numberWithDouble:place.viewport.southWest.longitude]; - - placeData[@"viewport"] = viewportMap; - } + if (place.viewportInfo) { + NSMutableDictionary *viewportMap = [[NSMutableDictionary alloc] init]; + viewportMap[@"latitudeNE"] = [NSNumber numberWithDouble:place.viewportInfo.northEast.latitude]; + viewportMap[@"longitudeNE"] = [NSNumber numberWithDouble:place.viewportInfo.northEast.longitude]; + viewportMap[@"latitudeSW"] = [NSNumber numberWithDouble:place.viewportInfo.southWest.latitude]; + viewportMap[@"longitudeSW"] = [NSNumber numberWithDouble:place.viewportInfo.southWest.longitude]; + + placeData[@"viewport"] = viewportMap; + } if (place.plusCode) { NSMutableDictionary *plusCodeMap = [[NSMutableDictionary alloc] init];