@inoxialabs/react-native-nitro-location-geocoder 0.1.0 → 1.0.0

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.
Files changed (44) hide show
  1. package/NitroLocationGeocoder.podspec +28 -28
  2. package/README.md +118 -78
  3. package/android/CMakeLists.txt +25 -25
  4. package/android/build.gradle +129 -129
  5. package/android/fix-prefab.gradle +44 -44
  6. package/android/gradle.properties +5 -5
  7. package/android/src/main/AndroidManifest.xml +2 -2
  8. package/android/src/main/cpp/cpp-adapter.cpp +6 -6
  9. package/android/src/main/java/com/margelo/nitro/locationgeocoder/HybridLocationGeocoder.kt +85 -57
  10. package/android/src/main/java/com/margelo/nitro/locationgeocoder/NitroLocationGeocoderPackage.kt +18 -18
  11. package/ios/Bridge.h +1 -1
  12. package/ios/HybridLocationGeocoder.swift +62 -19
  13. package/nitro.json +24 -24
  14. package/nitrogen/generated/.gitattributes +1 -1
  15. package/nitrogen/generated/android/NitroLocationGeocoder+autolinking.cmake +81 -81
  16. package/nitrogen/generated/android/NitroLocationGeocoder+autolinking.gradle +27 -27
  17. package/nitrogen/generated/android/NitroLocationGeocoderOnLoad.cpp +54 -54
  18. package/nitrogen/generated/android/NitroLocationGeocoderOnLoad.hpp +34 -34
  19. package/nitrogen/generated/android/c++/JHybridLocationGeocoderSpec.cpp +69 -69
  20. package/nitrogen/generated/android/c++/JHybridLocationGeocoderSpec.hpp +63 -63
  21. package/nitrogen/generated/android/c++/JLocationGeocoderResult.hpp +77 -77
  22. package/nitrogen/generated/android/kotlin/com/margelo/nitro/locationgeocoder/HybridLocationGeocoderSpec.kt +55 -55
  23. package/nitrogen/generated/android/kotlin/com/margelo/nitro/locationgeocoder/LocationGeocoderResult.kt +53 -53
  24. package/nitrogen/generated/android/kotlin/com/margelo/nitro/locationgeocoder/NitroLocationGeocoderOnLoad.kt +35 -35
  25. package/nitrogen/generated/ios/NitroLocationGeocoder+autolinking.rb +60 -60
  26. package/nitrogen/generated/ios/NitroLocationGeocoder-Swift-Cxx-Bridge.cpp +49 -49
  27. package/nitrogen/generated/ios/NitroLocationGeocoder-Swift-Cxx-Bridge.hpp +114 -114
  28. package/nitrogen/generated/ios/NitroLocationGeocoder-Swift-Cxx-Umbrella.hpp +48 -48
  29. package/nitrogen/generated/ios/NitroLocationGeocoderAutolinking.mm +33 -33
  30. package/nitrogen/generated/ios/NitroLocationGeocoderAutolinking.swift +26 -26
  31. package/nitrogen/generated/ios/c++/HybridLocationGeocoderSpecSwift.cpp +11 -11
  32. package/nitrogen/generated/ios/c++/HybridLocationGeocoderSpecSwift.hpp +85 -85
  33. package/nitrogen/generated/ios/swift/Func_void_LocationGeocoderResult.swift +46 -46
  34. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -46
  35. package/nitrogen/generated/ios/swift/HybridLocationGeocoderSpec.swift +55 -55
  36. package/nitrogen/generated/ios/swift/HybridLocationGeocoderSpec_cxx.swift +145 -145
  37. package/nitrogen/generated/ios/swift/LocationGeocoderResult.swift +54 -54
  38. package/nitrogen/generated/shared/c++/HybridLocationGeocoderSpec.cpp +21 -21
  39. package/nitrogen/generated/shared/c++/HybridLocationGeocoderSpec.hpp +65 -65
  40. package/nitrogen/generated/shared/c++/LocationGeocoderResult.hpp +103 -103
  41. package/package.json +65 -65
  42. package/react-native.config.js +8 -8
  43. package/src/index.ts +39 -7
  44. package/src/specs/LocationGeocoder.nitro.ts +14 -14
@@ -1,46 +1,46 @@
1
- ///
2
- /// Func_void_LocationGeocoderResult.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © Marc Rousavy @ Margelo
6
- ///
7
-
8
- import NitroModules
9
-
10
- /**
11
- * Wraps a Swift `(_ value: LocationGeocoderResult) -> Void` as a class.
12
- * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
- */
14
- public final class Func_void_LocationGeocoderResult {
15
- public typealias bridge = margelo.nitro.locationgeocoder.bridge.swift
16
-
17
- private let closure: (_ value: LocationGeocoderResult) -> Void
18
-
19
- public init(_ closure: @escaping (_ value: LocationGeocoderResult) -> Void) {
20
- self.closure = closure
21
- }
22
-
23
- @inline(__always)
24
- public func call(value: LocationGeocoderResult) -> Void {
25
- self.closure(value)
26
- }
27
-
28
- /**
29
- * Casts this instance to a retained unsafe raw pointer.
30
- * This acquires one additional strong reference on the object!
31
- */
32
- @inline(__always)
33
- public func toUnsafe() -> UnsafeMutableRawPointer {
34
- return Unmanaged.passRetained(self).toOpaque()
35
- }
36
-
37
- /**
38
- * Casts an unsafe pointer to a `Func_void_LocationGeocoderResult`.
39
- * The pointer has to be a retained opaque `Unmanaged<Func_void_LocationGeocoderResult>`.
40
- * This removes one strong reference from the object!
41
- */
42
- @inline(__always)
43
- public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_LocationGeocoderResult {
44
- return Unmanaged<Func_void_LocationGeocoderResult>.fromOpaque(pointer).takeRetainedValue()
45
- }
46
- }
1
+ ///
2
+ /// Func_void_LocationGeocoderResult.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: LocationGeocoderResult) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_LocationGeocoderResult {
15
+ public typealias bridge = margelo.nitro.locationgeocoder.bridge.swift
16
+
17
+ private let closure: (_ value: LocationGeocoderResult) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: LocationGeocoderResult) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: LocationGeocoderResult) -> Void {
25
+ self.closure(value)
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_LocationGeocoderResult`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_LocationGeocoderResult>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_LocationGeocoderResult {
44
+ return Unmanaged<Func_void_LocationGeocoderResult>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -1,46 +1,46 @@
1
- ///
2
- /// Func_void_std__exception_ptr.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © Marc Rousavy @ Margelo
6
- ///
7
-
8
- import NitroModules
9
-
10
- /**
11
- * Wraps a Swift `(_ error: Error) -> Void` as a class.
12
- * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
- */
14
- public final class Func_void_std__exception_ptr {
15
- public typealias bridge = margelo.nitro.locationgeocoder.bridge.swift
16
-
17
- private let closure: (_ error: Error) -> Void
18
-
19
- public init(_ closure: @escaping (_ error: Error) -> Void) {
20
- self.closure = closure
21
- }
22
-
23
- @inline(__always)
24
- public func call(error: std.exception_ptr) -> Void {
25
- self.closure(RuntimeError.from(cppError: error))
26
- }
27
-
28
- /**
29
- * Casts this instance to a retained unsafe raw pointer.
30
- * This acquires one additional strong reference on the object!
31
- */
32
- @inline(__always)
33
- public func toUnsafe() -> UnsafeMutableRawPointer {
34
- return Unmanaged.passRetained(self).toOpaque()
35
- }
36
-
37
- /**
38
- * Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
39
- * The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
40
- * This removes one strong reference from the object!
41
- */
42
- @inline(__always)
43
- public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
44
- return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
45
- }
46
- }
1
+ ///
2
+ /// Func_void_std__exception_ptr.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ error: Error) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_std__exception_ptr {
15
+ public typealias bridge = margelo.nitro.locationgeocoder.bridge.swift
16
+
17
+ private let closure: (_ error: Error) -> Void
18
+
19
+ public init(_ closure: @escaping (_ error: Error) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(error: std.exception_ptr) -> Void {
25
+ self.closure(RuntimeError.from(cppError: error))
26
+ }
27
+
28
+ /**
29
+ * Casts this instance to a retained unsafe raw pointer.
30
+ * This acquires one additional strong reference on the object!
31
+ */
32
+ @inline(__always)
33
+ public func toUnsafe() -> UnsafeMutableRawPointer {
34
+ return Unmanaged.passRetained(self).toOpaque()
35
+ }
36
+
37
+ /**
38
+ * Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
44
+ return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -1,55 +1,55 @@
1
- ///
2
- /// HybridLocationGeocoderSpec.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © Marc Rousavy @ Margelo
6
- ///
7
-
8
- import NitroModules
9
-
10
- /// See ``HybridLocationGeocoderSpec``
11
- public protocol HybridLocationGeocoderSpec_protocol: HybridObject {
12
- // Properties
13
-
14
-
15
- // Methods
16
- func reverseGeocode(latitude: Double, longitude: Double, locale: String) throws -> Promise<LocationGeocoderResult>
17
- }
18
-
19
- public extension HybridLocationGeocoderSpec_protocol {
20
- /// Default implementation of ``HybridObject.toString``
21
- func toString() -> String {
22
- return "[HybridObject LocationGeocoder]"
23
- }
24
- }
25
-
26
- /// See ``HybridLocationGeocoderSpec``
27
- open class HybridLocationGeocoderSpec_base {
28
- private weak var cxxWrapper: HybridLocationGeocoderSpec_cxx? = nil
29
- public init() { }
30
- public func getCxxWrapper() -> HybridLocationGeocoderSpec_cxx {
31
- #if DEBUG
32
- guard self is any HybridLocationGeocoderSpec else {
33
- fatalError("`self` is not a `HybridLocationGeocoderSpec`! Did you accidentally inherit from `HybridLocationGeocoderSpec_base` instead of `HybridLocationGeocoderSpec`?")
34
- }
35
- #endif
36
- if let cxxWrapper = self.cxxWrapper {
37
- return cxxWrapper
38
- } else {
39
- let cxxWrapper = HybridLocationGeocoderSpec_cxx(self as! any HybridLocationGeocoderSpec)
40
- self.cxxWrapper = cxxWrapper
41
- return cxxWrapper
42
- }
43
- }
44
- }
45
-
46
- /**
47
- * A Swift base-protocol representing the LocationGeocoder HybridObject.
48
- * Implement this protocol to create Swift-based instances of LocationGeocoder.
49
- * ```swift
50
- * class HybridLocationGeocoder : HybridLocationGeocoderSpec {
51
- * // ...
52
- * }
53
- * ```
54
- */
55
- public typealias HybridLocationGeocoderSpec = HybridLocationGeocoderSpec_protocol & HybridLocationGeocoderSpec_base
1
+ ///
2
+ /// HybridLocationGeocoderSpec.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /// See ``HybridLocationGeocoderSpec``
11
+ public protocol HybridLocationGeocoderSpec_protocol: HybridObject {
12
+ // Properties
13
+
14
+
15
+ // Methods
16
+ func reverseGeocode(latitude: Double, longitude: Double, locale: String) throws -> Promise<LocationGeocoderResult>
17
+ }
18
+
19
+ public extension HybridLocationGeocoderSpec_protocol {
20
+ /// Default implementation of ``HybridObject.toString``
21
+ func toString() -> String {
22
+ return "[HybridObject LocationGeocoder]"
23
+ }
24
+ }
25
+
26
+ /// See ``HybridLocationGeocoderSpec``
27
+ open class HybridLocationGeocoderSpec_base {
28
+ private weak var cxxWrapper: HybridLocationGeocoderSpec_cxx? = nil
29
+ public init() { }
30
+ public func getCxxWrapper() -> HybridLocationGeocoderSpec_cxx {
31
+ #if DEBUG
32
+ guard self is any HybridLocationGeocoderSpec else {
33
+ fatalError("`self` is not a `HybridLocationGeocoderSpec`! Did you accidentally inherit from `HybridLocationGeocoderSpec_base` instead of `HybridLocationGeocoderSpec`?")
34
+ }
35
+ #endif
36
+ if let cxxWrapper = self.cxxWrapper {
37
+ return cxxWrapper
38
+ } else {
39
+ let cxxWrapper = HybridLocationGeocoderSpec_cxx(self as! any HybridLocationGeocoderSpec)
40
+ self.cxxWrapper = cxxWrapper
41
+ return cxxWrapper
42
+ }
43
+ }
44
+ }
45
+
46
+ /**
47
+ * A Swift base-protocol representing the LocationGeocoder HybridObject.
48
+ * Implement this protocol to create Swift-based instances of LocationGeocoder.
49
+ * ```swift
50
+ * class HybridLocationGeocoder : HybridLocationGeocoderSpec {
51
+ * // ...
52
+ * }
53
+ * ```
54
+ */
55
+ public typealias HybridLocationGeocoderSpec = HybridLocationGeocoderSpec_protocol & HybridLocationGeocoderSpec_base
@@ -1,145 +1,145 @@
1
- ///
2
- /// HybridLocationGeocoderSpec_cxx.swift
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © Marc Rousavy @ Margelo
6
- ///
7
-
8
- import NitroModules
9
-
10
- /**
11
- * A class implementation that bridges HybridLocationGeocoderSpec over to C++.
12
- * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
13
- *
14
- * Also, some Swift types need to be bridged with special handling:
15
- * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
16
- * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
17
- * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
18
- */
19
- open class HybridLocationGeocoderSpec_cxx {
20
- /**
21
- * The Swift <> C++ bridge's namespace (`margelo::nitro::locationgeocoder::bridge::swift`)
22
- * from `NitroLocationGeocoder-Swift-Cxx-Bridge.hpp`.
23
- * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
24
- */
25
- public typealias bridge = margelo.nitro.locationgeocoder.bridge.swift
26
-
27
- /**
28
- * Holds an instance of the `HybridLocationGeocoderSpec` Swift protocol.
29
- */
30
- private var __implementation: any HybridLocationGeocoderSpec
31
-
32
- /**
33
- * Holds a weak pointer to the C++ class that wraps the Swift class.
34
- */
35
- private var __cxxPart: bridge.std__weak_ptr_HybridLocationGeocoderSpec_
36
-
37
- /**
38
- * Create a new `HybridLocationGeocoderSpec_cxx` that wraps the given `HybridLocationGeocoderSpec`.
39
- * All properties and methods bridge to C++ types.
40
- */
41
- public init(_ implementation: any HybridLocationGeocoderSpec) {
42
- self.__implementation = implementation
43
- self.__cxxPart = .init()
44
- /* no base class */
45
- }
46
-
47
- /**
48
- * Get the actual `HybridLocationGeocoderSpec` instance this class wraps.
49
- */
50
- @inline(__always)
51
- public func getHybridLocationGeocoderSpec() -> any HybridLocationGeocoderSpec {
52
- return __implementation
53
- }
54
-
55
- /**
56
- * Casts this instance to a retained unsafe raw pointer.
57
- * This acquires one additional strong reference on the object!
58
- */
59
- public func toUnsafe() -> UnsafeMutableRawPointer {
60
- return Unmanaged.passRetained(self).toOpaque()
61
- }
62
-
63
- /**
64
- * Casts an unsafe pointer to a `HybridLocationGeocoderSpec_cxx`.
65
- * The pointer has to be a retained opaque `Unmanaged<HybridLocationGeocoderSpec_cxx>`.
66
- * This removes one strong reference from the object!
67
- */
68
- public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridLocationGeocoderSpec_cxx {
69
- return Unmanaged<HybridLocationGeocoderSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
70
- }
71
-
72
- /**
73
- * Gets (or creates) the C++ part of this Hybrid Object.
74
- * The C++ part is a `std::shared_ptr<HybridLocationGeocoderSpec>`.
75
- */
76
- public func getCxxPart() -> bridge.std__shared_ptr_HybridLocationGeocoderSpec_ {
77
- let cachedCxxPart = self.__cxxPart.lock()
78
- if Bool(fromCxx: cachedCxxPart) {
79
- return cachedCxxPart
80
- } else {
81
- let newCxxPart = bridge.create_std__shared_ptr_HybridLocationGeocoderSpec_(self.toUnsafe())
82
- __cxxPart = bridge.weakify_std__shared_ptr_HybridLocationGeocoderSpec_(newCxxPart)
83
- return newCxxPart
84
- }
85
- }
86
-
87
-
88
-
89
- /**
90
- * Get the memory size of the Swift class (plus size of any other allocations)
91
- * so the JS VM can properly track it and garbage-collect the JS object if needed.
92
- */
93
- @inline(__always)
94
- public var memorySize: Int {
95
- return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
96
- }
97
-
98
- /**
99
- * Compares this object with the given [other] object for reference equality.
100
- */
101
- @inline(__always)
102
- public func equals(other: HybridLocationGeocoderSpec_cxx) -> Bool {
103
- return self.__implementation === other.__implementation
104
- }
105
-
106
- /**
107
- * Call dispose() on the Swift class.
108
- * This _may_ be called manually from JS.
109
- */
110
- @inline(__always)
111
- public func dispose() {
112
- self.__implementation.dispose()
113
- }
114
-
115
- /**
116
- * Call toString() on the Swift class.
117
- */
118
- @inline(__always)
119
- public func toString() -> String {
120
- return self.__implementation.toString()
121
- }
122
-
123
- // Properties
124
-
125
-
126
- // Methods
127
- @inline(__always)
128
- public final func reverseGeocode(latitude: Double, longitude: Double, locale: std.string) -> bridge.Result_std__shared_ptr_Promise_LocationGeocoderResult___ {
129
- do {
130
- let __result = try self.__implementation.reverseGeocode(latitude: latitude, longitude: longitude, locale: String(locale))
131
- let __resultCpp = { () -> bridge.std__shared_ptr_Promise_LocationGeocoderResult__ in
132
- let __promise = bridge.create_std__shared_ptr_Promise_LocationGeocoderResult__()
133
- let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_LocationGeocoderResult__(__promise)
134
- __result
135
- .then({ __result in __promiseHolder.resolve(__result) })
136
- .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
137
- return __promise
138
- }()
139
- return bridge.create_Result_std__shared_ptr_Promise_LocationGeocoderResult___(__resultCpp)
140
- } catch (let __error) {
141
- let __exceptionPtr = __error.toCpp()
142
- return bridge.create_Result_std__shared_ptr_Promise_LocationGeocoderResult___(__exceptionPtr)
143
- }
144
- }
145
- }
1
+ ///
2
+ /// HybridLocationGeocoderSpec_cxx.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * A class implementation that bridges HybridLocationGeocoderSpec over to C++.
12
+ * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
13
+ *
14
+ * Also, some Swift types need to be bridged with special handling:
15
+ * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
16
+ * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
17
+ * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
18
+ */
19
+ open class HybridLocationGeocoderSpec_cxx {
20
+ /**
21
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::locationgeocoder::bridge::swift`)
22
+ * from `NitroLocationGeocoder-Swift-Cxx-Bridge.hpp`.
23
+ * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
24
+ */
25
+ public typealias bridge = margelo.nitro.locationgeocoder.bridge.swift
26
+
27
+ /**
28
+ * Holds an instance of the `HybridLocationGeocoderSpec` Swift protocol.
29
+ */
30
+ private var __implementation: any HybridLocationGeocoderSpec
31
+
32
+ /**
33
+ * Holds a weak pointer to the C++ class that wraps the Swift class.
34
+ */
35
+ private var __cxxPart: bridge.std__weak_ptr_HybridLocationGeocoderSpec_
36
+
37
+ /**
38
+ * Create a new `HybridLocationGeocoderSpec_cxx` that wraps the given `HybridLocationGeocoderSpec`.
39
+ * All properties and methods bridge to C++ types.
40
+ */
41
+ public init(_ implementation: any HybridLocationGeocoderSpec) {
42
+ self.__implementation = implementation
43
+ self.__cxxPart = .init()
44
+ /* no base class */
45
+ }
46
+
47
+ /**
48
+ * Get the actual `HybridLocationGeocoderSpec` instance this class wraps.
49
+ */
50
+ @inline(__always)
51
+ public func getHybridLocationGeocoderSpec() -> any HybridLocationGeocoderSpec {
52
+ return __implementation
53
+ }
54
+
55
+ /**
56
+ * Casts this instance to a retained unsafe raw pointer.
57
+ * This acquires one additional strong reference on the object!
58
+ */
59
+ public func toUnsafe() -> UnsafeMutableRawPointer {
60
+ return Unmanaged.passRetained(self).toOpaque()
61
+ }
62
+
63
+ /**
64
+ * Casts an unsafe pointer to a `HybridLocationGeocoderSpec_cxx`.
65
+ * The pointer has to be a retained opaque `Unmanaged<HybridLocationGeocoderSpec_cxx>`.
66
+ * This removes one strong reference from the object!
67
+ */
68
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridLocationGeocoderSpec_cxx {
69
+ return Unmanaged<HybridLocationGeocoderSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
70
+ }
71
+
72
+ /**
73
+ * Gets (or creates) the C++ part of this Hybrid Object.
74
+ * The C++ part is a `std::shared_ptr<HybridLocationGeocoderSpec>`.
75
+ */
76
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridLocationGeocoderSpec_ {
77
+ let cachedCxxPart = self.__cxxPart.lock()
78
+ if Bool(fromCxx: cachedCxxPart) {
79
+ return cachedCxxPart
80
+ } else {
81
+ let newCxxPart = bridge.create_std__shared_ptr_HybridLocationGeocoderSpec_(self.toUnsafe())
82
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridLocationGeocoderSpec_(newCxxPart)
83
+ return newCxxPart
84
+ }
85
+ }
86
+
87
+
88
+
89
+ /**
90
+ * Get the memory size of the Swift class (plus size of any other allocations)
91
+ * so the JS VM can properly track it and garbage-collect the JS object if needed.
92
+ */
93
+ @inline(__always)
94
+ public var memorySize: Int {
95
+ return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
96
+ }
97
+
98
+ /**
99
+ * Compares this object with the given [other] object for reference equality.
100
+ */
101
+ @inline(__always)
102
+ public func equals(other: HybridLocationGeocoderSpec_cxx) -> Bool {
103
+ return self.__implementation === other.__implementation
104
+ }
105
+
106
+ /**
107
+ * Call dispose() on the Swift class.
108
+ * This _may_ be called manually from JS.
109
+ */
110
+ @inline(__always)
111
+ public func dispose() {
112
+ self.__implementation.dispose()
113
+ }
114
+
115
+ /**
116
+ * Call toString() on the Swift class.
117
+ */
118
+ @inline(__always)
119
+ public func toString() -> String {
120
+ return self.__implementation.toString()
121
+ }
122
+
123
+ // Properties
124
+
125
+
126
+ // Methods
127
+ @inline(__always)
128
+ public final func reverseGeocode(latitude: Double, longitude: Double, locale: std.string) -> bridge.Result_std__shared_ptr_Promise_LocationGeocoderResult___ {
129
+ do {
130
+ let __result = try self.__implementation.reverseGeocode(latitude: latitude, longitude: longitude, locale: String(locale))
131
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_LocationGeocoderResult__ in
132
+ let __promise = bridge.create_std__shared_ptr_Promise_LocationGeocoderResult__()
133
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_LocationGeocoderResult__(__promise)
134
+ __result
135
+ .then({ __result in __promiseHolder.resolve(__result) })
136
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
137
+ return __promise
138
+ }()
139
+ return bridge.create_Result_std__shared_ptr_Promise_LocationGeocoderResult___(__resultCpp)
140
+ } catch (let __error) {
141
+ let __exceptionPtr = __error.toCpp()
142
+ return bridge.create_Result_std__shared_ptr_Promise_LocationGeocoderResult___(__exceptionPtr)
143
+ }
144
+ }
145
+ }