Skip to content

Commit 3618664

Browse files
committed
Add synchronous geocode request
1 parent ce520e9 commit 3618664

5 files changed

Lines changed: 198 additions & 85 deletions

File tree

LMGeocoder.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22

33
s.name = 'LMGeocoder'
4-
s.version = '1.0.5'
4+
s.version = '1.0.6'
55
s.summary = 'Simple wrapper for geocoding and reverse geocoding, using both Google Geocoding API and Apple iOS Geocoding Framework.'
66
s.homepage = 'https://github.com/lminhtm/LMGeocoder'
77
s.license = {

LMGeocoder/LMGeocoder.h

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#import <CoreLocation/CoreLocation.h>
1111
#import "LMAddress.h"
1212

13+
NS_ASSUME_NONNULL_BEGIN
14+
1315
/*!
1416
* LMGeocoder service API.
1517
*/
@@ -50,12 +52,12 @@ typedef void (^LMGeocodeCallback) (NSArray<LMAddress *> * _Nullable results, NS
5052
/*!
5153
* Get shared instance.
5254
*/
53-
+ (nonnull LMGeocoder *)sharedInstance;
55+
+ (LMGeocoder *)sharedInstance;
5456

5557
/*!
5658
* Convenience constructor for LMGeocoder.
5759
*/
58-
+ (nonnull LMGeocoder *)geocoder;
60+
+ (LMGeocoder *)geocoder;
5961

6062
/*!
6163
* Submits a forward-geocoding request using the specified string.
@@ -67,10 +69,23 @@ typedef void (^LMGeocodeCallback) (NSArray<LMAddress *> * _Nullable results, NS
6769
* @param service The service API used to geocode.
6870
* @param handler The callback to invoke with the geocode results. The callback will be invoked asynchronously from the main thread.
6971
*/
70-
- (void)geocodeAddressString:(nonnull NSString *)addressString
72+
- (void)geocodeAddressString:(NSString *)addressString
7173
service:(LMGeocoderService)service
7274
completionHandler:(nullable LMGeocodeCallback)handler;
7375

76+
/*!
77+
* Submits a synchronous forward-geocoding request using the specified string.
78+
*
79+
* @param addressString The string describing the location you want to look up.
80+
* @param service The service API used to geocode.
81+
* @param error The error.
82+
*
83+
* @return The geocode results.
84+
*/
85+
- (nullable NSArray *)geocodeAddressString:(NSString *)addressString
86+
service:(LMGeocoderService)service
87+
error:(NSError **)error;
88+
7489
/*!
7590
* Submits a reverse-geocoding request for the specified coordinate.
7691
* After initiating a reverse-geocoding request, do not attempt to initiate another reverse- or forward-geocoding request.
@@ -85,9 +100,24 @@ typedef void (^LMGeocodeCallback) (NSArray<LMAddress *> * _Nullable results, NS
85100
service:(LMGeocoderService)service
86101
completionHandler:(nullable LMGeocodeCallback)handler;
87102

103+
/*!
104+
* Submits a synchronous reverse-geocoding request for the specified coordinate.
105+
*
106+
* @param coordinate The coordinate to look up.
107+
* @param service The service API used to geocode.
108+
* @param error The error.
109+
*
110+
* @return The reverse geocode results.
111+
*/
112+
- (nullable NSArray *)reverseGeocodeCoordinate:(CLLocationCoordinate2D)coordinate
113+
service:(LMGeocoderService)service
114+
error:(NSError **)error;
115+
88116
/*!
89117
* Cancels a pending geocoding request.
90118
*/
91119
- (void)cancelGeocode;
92120

93121
@end
122+
123+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)