AI-generated Key Takeaways
-
GMSAddress
stores human-readable address information obtained from reverse geocoding requests usingGMSGeocoder
. -
It contains properties for various address components like coordinate, street, city, region, postal code, and country.
-
The
lines
property provides an array of formatted address lines, offering a comprehensive representation. -
While
addressLine1
andaddressLine2
were previously used, they are now deprecated in favor of thelines
property. -
Some address fields may be nil if the information is unavailable.
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;