react-native-nitro-geolocation 0.0.1 → 0.1.1
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.
- package/LICENSE +4 -1
- package/README.md +318 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/GetCurrentPosition.kt +341 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/NitroGeolocation.kt +76 -5
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/RequestAuthorization.kt +164 -0
- package/android/src/main/java/com/margelo/nitro/nitrogeolocation/WatchPosition.kt +228 -0
- package/ios/LocationManager.swift +529 -0
- package/ios/NitroGeolocation.swift +96 -2
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/c++/JAuthorizationLevelInternal.hpp +62 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +74 -0
- package/nitrogen/generated/android/c++/JFunc_void_GeolocationError.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_GeolocationResponse.hpp +79 -0
- package/nitrogen/generated/android/c++/JGeolocationCoordinates.hpp +77 -0
- package/nitrogen/generated/android/c++/JGeolocationError.hpp +69 -0
- package/nitrogen/generated/android/c++/JGeolocationOptions.hpp +77 -0
- package/nitrogen/generated/android/c++/JGeolocationResponse.hpp +59 -0
- package/nitrogen/generated/android/c++/JHybridNitroGeolocationSpec.cpp +98 -0
- package/nitrogen/generated/android/c++/JHybridNitroGeolocationSpec.hpp +69 -0
- package/nitrogen/generated/android/c++/JLocationProviderInternal.hpp +62 -0
- package/nitrogen/generated/android/c++/JRNConfigurationInternal.hpp +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/AuthorizationLevelInternal.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_GeolocationError.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/Func_void_GeolocationResponse.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationCoordinates.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationError.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationOptions.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/GeolocationResponse.kt +32 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/HybridNitroGeolocationSpec.kt +87 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/LocationProviderInternal.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/RNConfigurationInternal.kt +38 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrogeolocation/nitrogeolocationOnLoad.kt +35 -0
- package/nitrogen/generated/android/nitrogeolocation+autolinking.cmake +81 -0
- package/nitrogen/generated/android/nitrogeolocation+autolinking.gradle +27 -0
- package/nitrogen/generated/android/nitrogeolocationOnLoad.cpp +50 -0
- package/nitrogen/generated/android/nitrogeolocationOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/NitroGeolocation+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.cpp +56 -0
- package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Bridge.hpp +252 -0
- package/nitrogen/generated/ios/NitroGeolocation-Swift-Cxx-Umbrella.hpp +67 -0
- package/nitrogen/generated/ios/NitroGeolocationAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroGeolocationAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridNitroGeolocationSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroGeolocationSpecSwift.hpp +125 -0
- package/nitrogen/generated/ios/swift/AuthorizationLevelInternal.swift +44 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_GeolocationError.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_GeolocationResponse.swift +47 -0
- package/nitrogen/generated/ios/swift/GeolocationCoordinates.swift +149 -0
- package/nitrogen/generated/ios/swift/GeolocationError.swift +79 -0
- package/nitrogen/generated/ios/swift/GeolocationOptions.swift +185 -0
- package/nitrogen/generated/ios/swift/GeolocationResponse.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridNitroGeolocationSpec.swift +54 -0
- package/nitrogen/generated/ios/swift/HybridNitroGeolocationSpec_cxx.swift +236 -0
- package/nitrogen/generated/ios/swift/LocationProviderInternal.swift +44 -0
- package/nitrogen/generated/ios/swift/RNConfigurationInternal.swift +104 -0
- package/nitrogen/generated/shared/c++/AuthorizationLevelInternal.hpp +80 -0
- package/nitrogen/generated/shared/c++/GeolocationCoordinates.hpp +91 -0
- package/nitrogen/generated/shared/c++/GeolocationError.hpp +83 -0
- package/nitrogen/generated/shared/c++/GeolocationOptions.hpp +91 -0
- package/nitrogen/generated/shared/c++/GeolocationResponse.hpp +72 -0
- package/nitrogen/generated/shared/c++/HybridNitroGeolocationSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridNitroGeolocationSpec.hpp +79 -0
- package/nitrogen/generated/shared/c++/LocationProviderInternal.hpp +80 -0
- package/nitrogen/generated/shared/c++/RNConfigurationInternal.hpp +84 -0
- package/package.json +34 -10
- package/src/NitroGeolocation.nitro.ts +38 -3
- package/src/NitroGeolocationModule.ts +5 -0
- package/src/clearWatch.ts +13 -0
- package/src/getCurrentPosition.ts +14 -0
- package/src/index.tsx +32 -7
- package/src/requestAuthorization.ts +9 -0
- package/src/setRNConfiguration.ts +22 -0
- package/src/stopObserving.ts +12 -0
- package/src/types.ts +43 -0
- package/src/watchPosition.ts +26 -0
- package/nitro.json +0 -17
- package/turbo.json +0 -42
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_GeolocationResponse.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ position: GeolocationResponse) -> Void` as a class.
|
|
13
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
14
|
+
*/
|
|
15
|
+
public final class Func_void_GeolocationResponse {
|
|
16
|
+
public typealias bridge = margelo.nitro.nitrogeolocation.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ position: GeolocationResponse) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ position: GeolocationResponse) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(position: GeolocationResponse) -> Void {
|
|
26
|
+
self.closure(position)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
31
|
+
* This acquires one additional strong reference on the object!
|
|
32
|
+
*/
|
|
33
|
+
@inline(__always)
|
|
34
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
35
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Casts an unsafe pointer to a `Func_void_GeolocationResponse`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_GeolocationResponse>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_GeolocationResponse {
|
|
45
|
+
return Unmanaged<Func_void_GeolocationResponse>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GeolocationCoordinates.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `GeolocationCoordinates`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias GeolocationCoordinates = margelo.nitro.nitrogeolocation.GeolocationCoordinates
|
|
14
|
+
|
|
15
|
+
public extension GeolocationCoordinates {
|
|
16
|
+
private typealias bridge = margelo.nitro.nitrogeolocation.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `GeolocationCoordinates`.
|
|
20
|
+
*/
|
|
21
|
+
init(latitude: Double, longitude: Double, altitude: Double?, accuracy: Double, altitudeAccuracy: Double?, heading: Double?, speed: Double?) {
|
|
22
|
+
self.init(latitude, longitude, { () -> bridge.std__optional_double_ in
|
|
23
|
+
if let __unwrappedValue = altitude {
|
|
24
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), accuracy, { () -> bridge.std__optional_double_ in
|
|
29
|
+
if let __unwrappedValue = altitudeAccuracy {
|
|
30
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
34
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
35
|
+
if let __unwrappedValue = heading {
|
|
36
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
37
|
+
} else {
|
|
38
|
+
return .init()
|
|
39
|
+
}
|
|
40
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
41
|
+
if let __unwrappedValue = speed {
|
|
42
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
43
|
+
} else {
|
|
44
|
+
return .init()
|
|
45
|
+
}
|
|
46
|
+
}())
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var latitude: Double {
|
|
50
|
+
@inline(__always)
|
|
51
|
+
get {
|
|
52
|
+
return self.__latitude
|
|
53
|
+
}
|
|
54
|
+
@inline(__always)
|
|
55
|
+
set {
|
|
56
|
+
self.__latitude = newValue
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var longitude: Double {
|
|
61
|
+
@inline(__always)
|
|
62
|
+
get {
|
|
63
|
+
return self.__longitude
|
|
64
|
+
}
|
|
65
|
+
@inline(__always)
|
|
66
|
+
set {
|
|
67
|
+
self.__longitude = newValue
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var altitude: Double? {
|
|
72
|
+
@inline(__always)
|
|
73
|
+
get {
|
|
74
|
+
return self.__altitude.value
|
|
75
|
+
}
|
|
76
|
+
@inline(__always)
|
|
77
|
+
set {
|
|
78
|
+
self.__altitude = { () -> bridge.std__optional_double_ in
|
|
79
|
+
if let __unwrappedValue = newValue {
|
|
80
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
81
|
+
} else {
|
|
82
|
+
return .init()
|
|
83
|
+
}
|
|
84
|
+
}()
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var accuracy: Double {
|
|
89
|
+
@inline(__always)
|
|
90
|
+
get {
|
|
91
|
+
return self.__accuracy
|
|
92
|
+
}
|
|
93
|
+
@inline(__always)
|
|
94
|
+
set {
|
|
95
|
+
self.__accuracy = newValue
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
var altitudeAccuracy: Double? {
|
|
100
|
+
@inline(__always)
|
|
101
|
+
get {
|
|
102
|
+
return self.__altitudeAccuracy.value
|
|
103
|
+
}
|
|
104
|
+
@inline(__always)
|
|
105
|
+
set {
|
|
106
|
+
self.__altitudeAccuracy = { () -> bridge.std__optional_double_ in
|
|
107
|
+
if let __unwrappedValue = newValue {
|
|
108
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
109
|
+
} else {
|
|
110
|
+
return .init()
|
|
111
|
+
}
|
|
112
|
+
}()
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
var heading: Double? {
|
|
117
|
+
@inline(__always)
|
|
118
|
+
get {
|
|
119
|
+
return self.__heading.value
|
|
120
|
+
}
|
|
121
|
+
@inline(__always)
|
|
122
|
+
set {
|
|
123
|
+
self.__heading = { () -> bridge.std__optional_double_ in
|
|
124
|
+
if let __unwrappedValue = newValue {
|
|
125
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
126
|
+
} else {
|
|
127
|
+
return .init()
|
|
128
|
+
}
|
|
129
|
+
}()
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
var speed: Double? {
|
|
134
|
+
@inline(__always)
|
|
135
|
+
get {
|
|
136
|
+
return self.__speed.value
|
|
137
|
+
}
|
|
138
|
+
@inline(__always)
|
|
139
|
+
set {
|
|
140
|
+
self.__speed = { () -> bridge.std__optional_double_ in
|
|
141
|
+
if let __unwrappedValue = newValue {
|
|
142
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
143
|
+
} else {
|
|
144
|
+
return .init()
|
|
145
|
+
}
|
|
146
|
+
}()
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GeolocationError.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `GeolocationError`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias GeolocationError = margelo.nitro.nitrogeolocation.GeolocationError
|
|
14
|
+
|
|
15
|
+
public extension GeolocationError {
|
|
16
|
+
private typealias bridge = margelo.nitro.nitrogeolocation.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `GeolocationError`.
|
|
20
|
+
*/
|
|
21
|
+
init(code: Double, message: String, PERMISSION_DENIED: Double, POSITION_UNAVAILABLE: Double, TIMEOUT: Double) {
|
|
22
|
+
self.init(code, std.string(message), PERMISSION_DENIED, POSITION_UNAVAILABLE, TIMEOUT)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var code: Double {
|
|
26
|
+
@inline(__always)
|
|
27
|
+
get {
|
|
28
|
+
return self.__code
|
|
29
|
+
}
|
|
30
|
+
@inline(__always)
|
|
31
|
+
set {
|
|
32
|
+
self.__code = newValue
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var message: String {
|
|
37
|
+
@inline(__always)
|
|
38
|
+
get {
|
|
39
|
+
return String(self.__message)
|
|
40
|
+
}
|
|
41
|
+
@inline(__always)
|
|
42
|
+
set {
|
|
43
|
+
self.__message = std.string(newValue)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var PERMISSION_DENIED: Double {
|
|
48
|
+
@inline(__always)
|
|
49
|
+
get {
|
|
50
|
+
return self.__PERMISSION_DENIED
|
|
51
|
+
}
|
|
52
|
+
@inline(__always)
|
|
53
|
+
set {
|
|
54
|
+
self.__PERMISSION_DENIED = newValue
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var POSITION_UNAVAILABLE: Double {
|
|
59
|
+
@inline(__always)
|
|
60
|
+
get {
|
|
61
|
+
return self.__POSITION_UNAVAILABLE
|
|
62
|
+
}
|
|
63
|
+
@inline(__always)
|
|
64
|
+
set {
|
|
65
|
+
self.__POSITION_UNAVAILABLE = newValue
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
var TIMEOUT: Double {
|
|
70
|
+
@inline(__always)
|
|
71
|
+
get {
|
|
72
|
+
return self.__TIMEOUT
|
|
73
|
+
}
|
|
74
|
+
@inline(__always)
|
|
75
|
+
set {
|
|
76
|
+
self.__TIMEOUT = newValue
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GeolocationOptions.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `GeolocationOptions`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias GeolocationOptions = margelo.nitro.nitrogeolocation.GeolocationOptions
|
|
14
|
+
|
|
15
|
+
public extension GeolocationOptions {
|
|
16
|
+
private typealias bridge = margelo.nitro.nitrogeolocation.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `GeolocationOptions`.
|
|
20
|
+
*/
|
|
21
|
+
init(timeout: Double?, maximumAge: Double?, enableHighAccuracy: Bool?, interval: Double?, fastestInterval: Double?, distanceFilter: Double?, useSignificantChanges: Bool?) {
|
|
22
|
+
self.init({ () -> bridge.std__optional_double_ in
|
|
23
|
+
if let __unwrappedValue = timeout {
|
|
24
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
29
|
+
if let __unwrappedValue = maximumAge {
|
|
30
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
34
|
+
}(), { () -> bridge.std__optional_bool_ in
|
|
35
|
+
if let __unwrappedValue = enableHighAccuracy {
|
|
36
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
37
|
+
} else {
|
|
38
|
+
return .init()
|
|
39
|
+
}
|
|
40
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
41
|
+
if let __unwrappedValue = interval {
|
|
42
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
43
|
+
} else {
|
|
44
|
+
return .init()
|
|
45
|
+
}
|
|
46
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
47
|
+
if let __unwrappedValue = fastestInterval {
|
|
48
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
49
|
+
} else {
|
|
50
|
+
return .init()
|
|
51
|
+
}
|
|
52
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
53
|
+
if let __unwrappedValue = distanceFilter {
|
|
54
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
55
|
+
} else {
|
|
56
|
+
return .init()
|
|
57
|
+
}
|
|
58
|
+
}(), { () -> bridge.std__optional_bool_ in
|
|
59
|
+
if let __unwrappedValue = useSignificantChanges {
|
|
60
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
61
|
+
} else {
|
|
62
|
+
return .init()
|
|
63
|
+
}
|
|
64
|
+
}())
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var timeout: Double? {
|
|
68
|
+
@inline(__always)
|
|
69
|
+
get {
|
|
70
|
+
return self.__timeout.value
|
|
71
|
+
}
|
|
72
|
+
@inline(__always)
|
|
73
|
+
set {
|
|
74
|
+
self.__timeout = { () -> bridge.std__optional_double_ in
|
|
75
|
+
if let __unwrappedValue = newValue {
|
|
76
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
77
|
+
} else {
|
|
78
|
+
return .init()
|
|
79
|
+
}
|
|
80
|
+
}()
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
var maximumAge: Double? {
|
|
85
|
+
@inline(__always)
|
|
86
|
+
get {
|
|
87
|
+
return self.__maximumAge.value
|
|
88
|
+
}
|
|
89
|
+
@inline(__always)
|
|
90
|
+
set {
|
|
91
|
+
self.__maximumAge = { () -> bridge.std__optional_double_ in
|
|
92
|
+
if let __unwrappedValue = newValue {
|
|
93
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
94
|
+
} else {
|
|
95
|
+
return .init()
|
|
96
|
+
}
|
|
97
|
+
}()
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
var enableHighAccuracy: Bool? {
|
|
102
|
+
@inline(__always)
|
|
103
|
+
get {
|
|
104
|
+
return self.__enableHighAccuracy.value
|
|
105
|
+
}
|
|
106
|
+
@inline(__always)
|
|
107
|
+
set {
|
|
108
|
+
self.__enableHighAccuracy = { () -> bridge.std__optional_bool_ in
|
|
109
|
+
if let __unwrappedValue = newValue {
|
|
110
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
111
|
+
} else {
|
|
112
|
+
return .init()
|
|
113
|
+
}
|
|
114
|
+
}()
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
var interval: Double? {
|
|
119
|
+
@inline(__always)
|
|
120
|
+
get {
|
|
121
|
+
return self.__interval.value
|
|
122
|
+
}
|
|
123
|
+
@inline(__always)
|
|
124
|
+
set {
|
|
125
|
+
self.__interval = { () -> bridge.std__optional_double_ in
|
|
126
|
+
if let __unwrappedValue = newValue {
|
|
127
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
128
|
+
} else {
|
|
129
|
+
return .init()
|
|
130
|
+
}
|
|
131
|
+
}()
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
var fastestInterval: Double? {
|
|
136
|
+
@inline(__always)
|
|
137
|
+
get {
|
|
138
|
+
return self.__fastestInterval.value
|
|
139
|
+
}
|
|
140
|
+
@inline(__always)
|
|
141
|
+
set {
|
|
142
|
+
self.__fastestInterval = { () -> bridge.std__optional_double_ in
|
|
143
|
+
if let __unwrappedValue = newValue {
|
|
144
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
145
|
+
} else {
|
|
146
|
+
return .init()
|
|
147
|
+
}
|
|
148
|
+
}()
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
var distanceFilter: Double? {
|
|
153
|
+
@inline(__always)
|
|
154
|
+
get {
|
|
155
|
+
return self.__distanceFilter.value
|
|
156
|
+
}
|
|
157
|
+
@inline(__always)
|
|
158
|
+
set {
|
|
159
|
+
self.__distanceFilter = { () -> bridge.std__optional_double_ in
|
|
160
|
+
if let __unwrappedValue = newValue {
|
|
161
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
162
|
+
} else {
|
|
163
|
+
return .init()
|
|
164
|
+
}
|
|
165
|
+
}()
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
var useSignificantChanges: Bool? {
|
|
170
|
+
@inline(__always)
|
|
171
|
+
get {
|
|
172
|
+
return self.__useSignificantChanges.value
|
|
173
|
+
}
|
|
174
|
+
@inline(__always)
|
|
175
|
+
set {
|
|
176
|
+
self.__useSignificantChanges = { () -> bridge.std__optional_bool_ in
|
|
177
|
+
if let __unwrappedValue = newValue {
|
|
178
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
179
|
+
} else {
|
|
180
|
+
return .init()
|
|
181
|
+
}
|
|
182
|
+
}()
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// GeolocationResponse.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `GeolocationResponse`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias GeolocationResponse = margelo.nitro.nitrogeolocation.GeolocationResponse
|
|
14
|
+
|
|
15
|
+
public extension GeolocationResponse {
|
|
16
|
+
private typealias bridge = margelo.nitro.nitrogeolocation.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `GeolocationResponse`.
|
|
20
|
+
*/
|
|
21
|
+
init(coords: GeolocationCoordinates, timestamp: Double) {
|
|
22
|
+
self.init(coords, timestamp)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var coords: GeolocationCoordinates {
|
|
26
|
+
@inline(__always)
|
|
27
|
+
get {
|
|
28
|
+
return self.__coords
|
|
29
|
+
}
|
|
30
|
+
@inline(__always)
|
|
31
|
+
set {
|
|
32
|
+
self.__coords = newValue
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var timestamp: Double {
|
|
37
|
+
@inline(__always)
|
|
38
|
+
get {
|
|
39
|
+
return self.__timestamp
|
|
40
|
+
}
|
|
41
|
+
@inline(__always)
|
|
42
|
+
set {
|
|
43
|
+
self.__timestamp = newValue
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroGeolocationSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/// See ``HybridNitroGeolocationSpec``
|
|
12
|
+
public protocol HybridNitroGeolocationSpec_protocol: HybridObject {
|
|
13
|
+
// Properties
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Methods
|
|
17
|
+
func setRNConfiguration(config: RNConfigurationInternal) throws -> Void
|
|
18
|
+
func requestAuthorization(success: (() -> Void)?, error: ((_ error: GeolocationError) -> Void)?) throws -> Void
|
|
19
|
+
func getCurrentPosition(success: @escaping (_ position: GeolocationResponse) -> Void, error: ((_ error: GeolocationError) -> Void)?, options: GeolocationOptions?) throws -> Void
|
|
20
|
+
func watchPosition(success: @escaping (_ position: GeolocationResponse) -> Void, error: ((_ error: GeolocationError) -> Void)?, options: GeolocationOptions?) throws -> Double
|
|
21
|
+
func clearWatch(watchId: Double) throws -> Void
|
|
22
|
+
func stopObserving() throws -> Void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/// See ``HybridNitroGeolocationSpec``
|
|
26
|
+
open class HybridNitroGeolocationSpec_base {
|
|
27
|
+
private weak var cxxWrapper: HybridNitroGeolocationSpec_cxx? = nil
|
|
28
|
+
public init() { }
|
|
29
|
+
public func getCxxWrapper() -> HybridNitroGeolocationSpec_cxx {
|
|
30
|
+
#if DEBUG
|
|
31
|
+
guard self is HybridNitroGeolocationSpec else {
|
|
32
|
+
fatalError("`self` is not a `HybridNitroGeolocationSpec`! Did you accidentally inherit from `HybridNitroGeolocationSpec_base` instead of `HybridNitroGeolocationSpec`?")
|
|
33
|
+
}
|
|
34
|
+
#endif
|
|
35
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
36
|
+
return cxxWrapper
|
|
37
|
+
} else {
|
|
38
|
+
let cxxWrapper = HybridNitroGeolocationSpec_cxx(self as! HybridNitroGeolocationSpec)
|
|
39
|
+
self.cxxWrapper = cxxWrapper
|
|
40
|
+
return cxxWrapper
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A Swift base-protocol representing the NitroGeolocation HybridObject.
|
|
47
|
+
* Implement this protocol to create Swift-based instances of NitroGeolocation.
|
|
48
|
+
* ```swift
|
|
49
|
+
* class HybridNitroGeolocation : HybridNitroGeolocationSpec {
|
|
50
|
+
* // ...
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
public typealias HybridNitroGeolocationSpec = HybridNitroGeolocationSpec_protocol & HybridNitroGeolocationSpec_base
|