Skip to content
Products
Solutions
By industry
By use case
Resources
Products
Solutions
By industry
By use case
Resources
Products
Solutions
By industry
By use case
Resources
Announcing Version 4.0 of the Maps and Places SDKs for iOS
Christopher Arriola
Developer Programs Engineer
Oct 14, 2020
Try Google Maps Platform
Get $200 usage monthly for no charge. Starting March 1, 2025, build more for free.*
Learn more

Today, we released new versions of Maps and Places SDKs for iOS. With version 4.0, both SDKs now support apps for devices running a minimum version of iOS 10 and the Places SDK got a handful of improvements providing a more intuitive API and better support for Swift developers.

iOS 10+

Dropping support for older versions and devices requires careful consideration—it’s something we don’t take lightly. On the other hand, increasing the minimum version improves developer velocity as it’s one less version to test against. Having over 99% of our customers’ users on iOS 10 or later served as a good signal to increase the minimum for this major version release. While we always recommend that you adopt the latest version of our SDKs, should your use case require you to support iOS 9, we still support Versions 3.x (Maps, Places) of our SDKs.

Improved Swift support

Fetching multiple fields when obtaining Place details requires combining GMSPlaceField types. Before Places SDK for iOS 4.0, combining fields in Swift required either force unwrapping, or conditional unwrapping, giving it the impression that combining certain types is unsafe.

For example, having name and Place ID in the same field might look like this:

// Force unwrapping
let fields: GMSPlaceField = GMSPlaceField(
    rawValue: GMSPlaceField.name.rawValue | GMSPlaceField.placeID.rawValue
)!

// ...or 
// Conditional unwrapping
if let fields: GMSPlaceField =  GMSPlaceField(
    rawValue: GMSPlaceField.name.rawValue | GMSPlaceField.placeID.rawValue
) { 
    // ...
}
Copied to clipboard!

The above syntax was previously required since GMSPlaceField was declared as an NS_ENUM. With Places SDK for iOS v4.0, we’ve updated GMSPlaceField to an NS_OPTIONS enabling you to use an array literal when combining fields which is a more familiar syntax in Swift. 

Rewriting the above code snippet would now look like this:

let fields: GMSPlaceField = [.name, .placeID]
Copied to clipboard!

Removing deprecations

Beginning with version 4.0, the Places SDK for iOS ends support of a handful of deprecated APIs in favor of alternatives:

  • The openNowStatus property of GMSPlace was removed. To obtain this status, use the field openingHours which contains more information about a place’s opening hours. 

  • GMSAutocompleteFetcher.init(bounds:,filter:)/initWithBounds:filter: was removed in favor of GMSAutocompleteFetcher.init(filter:)/initWithFilter:.

  • The properties autocompleteBounds and boundsMode were removed from GMSAutocompleteViewController, GMSAutocompleteResultsViewController, GMSAutocompleteContextViewController, GMSAutocompleteFetcher, and GMSAutocompleteTableDataSource in favor of the locationBias and locationRestriction values in the autocompleteFilter property.

  • The deprecated helper method setAutocompleteBoundsUsingNorthEastCorner(_, southWestCorner:)/setAutocompleteBoundsUsingNorthEastCorner:SouthWestCorner: from GMSAutocompleteViewController, GMSAutocompleteResultsViewController, and GMSAutocompleteTableDataSource have been removed in favor of setting the value of locationBias or locationRestriction in the autocompleteFilter property.

  • The deprecated helper methods in GMSPlacesClient  autocomplete(_,bounds:,filter:,callback:)/autocompleteQuery:bounds:filter:callback:, autocomplete(_,bounds:,boundsMode:,,filter:,callback:)/autocompleteQuery:bounds:boundsMode:filter:callback:, findAutocompletePredictions(fromQuery:,bounds:,boundsMode:,filter:,sessionToken:,callback:)/findAutocompletePredictionsFromQuery:bounds:boundsMode:filter:sessionToken:callback: have been removed in favor of findAutocompletePredictions(fromQuery:,filter:,sessionToken:,callback:)/findAutocompletePredictionsFromQuery:filter:sessionToken:callback

To continue using the old methods, be sure to specify a version lower than 4.0 until you are ready to update your code to use the replacement properties.

Install version 4.0 and check out our samples

You can now install version 4.0 of the Maps and Places SDK for iOS through CocoaPods or Carthage. We also recommend that you use Xcode 11.7 or later for this version of the SDK. To get a tour of our SDKs, make sure to check out our Swift and Objective-C samples as well as the Maps for iOS Utility Library.

For more information on Google Maps Platform, visit our website.

Clay cityscape
Clay cityscape
Get going with Google Maps Platform