@capgo/nativegeocoder 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -45,12 +45,12 @@ struct NativeGeocoderOptions: Decodable {
|
|
|
45
45
|
options.defaultLocale = call.getString("defaultLocale")
|
|
46
46
|
options.maxResults = call.getInt("maxResults") ?? 1
|
|
47
47
|
|
|
48
|
-
reverseGeocodeLocationHandler(location, options: options, completionHandler: {
|
|
48
|
+
reverseGeocodeLocationHandler(location, options: options, completionHandler: { (resultObj, error) in
|
|
49
49
|
if let error = error {
|
|
50
50
|
call.reject(error.message)
|
|
51
51
|
} else {
|
|
52
52
|
if let encodedResult = try? JSONEncoder().encode(resultObj),
|
|
53
|
-
let result = try? JSONSerialization.jsonObject(with: encodedResult, options: .allowFragments) as?
|
|
53
|
+
let result = try? JSONSerialization.jsonObject(with: encodedResult, options: .allowFragments) as? JSObject {
|
|
54
54
|
call.resolve(result)
|
|
55
55
|
} else {
|
|
56
56
|
call.reject("Invalid JSON result")
|
|
@@ -142,12 +142,12 @@ struct NativeGeocoderOptions: Decodable {
|
|
|
142
142
|
options.defaultLocale = call.getString("defaultLocale")
|
|
143
143
|
options.maxResults = call.getInt("maxResults") ?? 1
|
|
144
144
|
|
|
145
|
-
forwardGeocodeHandler(address, options: options, completionHandler: {
|
|
145
|
+
forwardGeocodeHandler(address, options: options, completionHandler: { (resultObj, error) in
|
|
146
146
|
if let error = error {
|
|
147
147
|
call.reject(error.message)
|
|
148
148
|
} else {
|
|
149
149
|
if let encodedResult = try? JSONEncoder().encode(resultObj),
|
|
150
|
-
let result = try? JSONSerialization.jsonObject(with: encodedResult, options: .allowFragments) as?
|
|
150
|
+
let result = try? JSONSerialization.jsonObject(with: encodedResult, options: .allowFragments) as? JSObject {
|
|
151
151
|
call.resolve(result)
|
|
152
152
|
} else {
|
|
153
153
|
call.reject("Invalid JSON result")
|