Skip to content

Commit

Permalink
fix: convert issue
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Jul 13, 2022
1 parent 6555a24 commit 621c928
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ios/Plugin/NativeGeocoder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ struct NativeGeocoderOptions: Decodable {
options.defaultLocale = call.getString("defaultLocale")
options.maxResults = call.getInt("maxResults") ?? 1

reverseGeocodeLocationHandler(location, options: options, completionHandler: { [weak self] (resultObj, error) in
reverseGeocodeLocationHandler(location, options: options, completionHandler: { (resultObj, error) in
if let error = error {
call.reject(error.message)
} else {
if let encodedResult = try? JSONEncoder().encode(resultObj),
let result = try? JSONSerialization.jsonObject(with: encodedResult, options: .allowFragments) as? [Dictionary<String,Any>] {
let result = try? JSONSerialization.jsonObject(with: encodedResult, options: .allowFragments) as? JSObject {
call.resolve(result)
} else {
call.reject("Invalid JSON result")
Expand Down Expand Up @@ -142,12 +142,12 @@ struct NativeGeocoderOptions: Decodable {
options.defaultLocale = call.getString("defaultLocale")
options.maxResults = call.getInt("maxResults") ?? 1

forwardGeocodeHandler(address, options: options, completionHandler: { [weak self] (resultObj, error) in
forwardGeocodeHandler(address, options: options, completionHandler: { (resultObj, error) in
if let error = error {
call.reject(error.message)
} else {
if let encodedResult = try? JSONEncoder().encode(resultObj),
let result = try? JSONSerialization.jsonObject(with: encodedResult, options: .allowFragments) as? [Dictionary<String,Any>] {
let result = try? JSONSerialization.jsonObject(with: encodedResult, options: .allowFragments) as? JSObject {
call.resolve(result)
} else {
call.reject("Invalid JSON result")
Expand Down

0 comments on commit 621c928

Please sign in to comment.