GoogleMaps Framework Reference

  • GMSAddress stores human-readable address information obtained from reverse geocoding requests using GMSGeocoder.

  • It contains properties like coordinate, thoroughfare, locality, country, and more representing different address components.

  • The lines property provides an array of formatted address lines for display purposes.

  • Deprecated methods addressLine1 and addressLine2 should be replaced with the lines property.

  • GMSAddress instances are immutable and should not be directly instantiated except in testing scenarios.

GMSAddress

@interface GMSAddress : NSObject <NSCopying, NSSecureCoding>

A result from a reverse geocode request, containing a human-readable address. This class is immutable and should not be instantiated directly unless under testing circumstances. Obtain an instance via GMSGeocoder.

Some of the fields may be nil, indicating they are not present.

  • Location, or kLocationCoordinate2DInvalid if unknown.

    Declaration

    Swift

    var coordinate: CLLocationCoordinate2D { get }

    Objective-C

    @property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
  • Street number and name.

    Declaration

    Swift

    var thoroughfare: String? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *thoroughfare;
  • Locality or city.

    Declaration

    Swift

    var locality: String? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *locality;
  • Subdivision of locality, district or park.

    Declaration

    Swift

    var subLocality: String? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *subLocality;
  • Region/State/Administrative area.

    Declaration

    Swift

    var administrativeArea: String? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *administrativeArea;
  • Postal/Zip code.

    Declaration

    Swift

    var postalCode: String? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *postalCode;
  • The country name.

    Declaration

    Swift

    var country: String? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *country;
  • An array of NSString containing formatted lines of the address. May be nil.

    Declaration

    Swift

    var lines: [String]? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSArray<NSString *> *lines;
  • Deprecated

    This method is obsolete and will be removed in a future release. Use the lines property instead.

    Returns the first line of the address.

    Declaration

    Swift

    func addressLine1() -> String?

    Objective-C

    - (nullable NSString *)addressLine1;
  • Deprecated

    This method is obsolete and will be removed in a future release. Use the lines property instead.

    Returns the second line of the address.

    Declaration

    Swift

    func addressLine2() -> String?

    Objective-C

    - (nullable NSString *)addressLine2;