GoogleRidesharingConsumer Framework Reference

  • GMTSLatLng represents a latitude and longitude coordinate pair, offering methods to interact with location data.

  • You can initialize GMTSLatLng objects with a specific latitude and longitude or from an existing CLLocationCoordinate2D object.

  • The class provides read-only access to the latitude and longitude properties of a given location.

  • It allows calculating the lateral distance between two GMTSLatLng objects and provides a means to determine if two locations are almost equal within a defined tolerance.

  • Use the initWithLatitude:longitude: method to initialize a GMTSLatLng instance, and avoid using the unavailable init method.

GMTSLatLng

@interface GMTSLatLng : GMTCImmutableData

Object representing the latitude and longitude.

  • Latitude associated with the object.

    Declaration

    Swift

    var latitude: Double { get }

    Objective-C

    @property (nonatomic, readonly) double latitude;
  • Longitude associated with the object.

    Declaration

    Swift

    var longitude: Double { get }

    Objective-C

    @property (nonatomic, readonly) double longitude;
  • Creates and returns an initialized GMTSLatLng from given CLLocationCoordinate2D.

    Declaration

    Swift

    convenience init(from coordinate: CLLocationCoordinate2D)

    Objective-C

    + (nonnull instancetype)latLngFromCoordinate:(CLLocationCoordinate2D)coordinate;
  • Initializes the object with the specified latitude and `longitude’.

    Declaration

    Swift

    init(latitude: Double, longitude: Double)

    Objective-C

    - (nonnull instancetype)initWithLatitude:(double)latitude
                                   longitude:(double)longitude;
  • Unavailable

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Creates and returns a CLLocationCoordinate2D from current GMTSLatLng.

    Declaration

    Swift

    func coordinate() -> CLLocationCoordinate2D

    Objective-C

    - (CLLocationCoordinate2D)coordinate;
  • Gets the lateral distance from the given latlng to the current location.

    Declaration

    Swift

    func distance(fromLocation latlng: GMTSLatLng) -> CLLocationDistance

    Objective-C

    - (CLLocationDistance)distanceFromLocation:(nonnull GMTSLatLng *)latlng;
  • Indicates if the receiver is almost equal to another given GMTSLatLng object based on the constant, GMTSLatLngDegreeAlmostEqualTolerance.

    Declaration

    Swift

    func isAlmostEqual(_ latlng: GMTSLatLng?) -> Bool

    Objective-C

    - (BOOL)isAlmostEqual:(nullable GMTSLatLng *)latlng;