react-native-nitro-compass 0.1.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.
- package/LICENSE +21 -0
- package/NitroCompass.podspec +31 -0
- package/README.md +206 -0
- package/android/CMakeLists.txt +32 -0
- package/android/build.gradle +148 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +9 -0
- package/android/src/main/java/com/margelo/nitro/nitrocompass/HybridNitroCompass.kt +481 -0
- package/android/src/main/java/com/margelo/nitro/nitrocompass/NitroCompassPackage.kt +18 -0
- package/app.plugin.js +16 -0
- package/ios/Bridge.h +8 -0
- package/ios/HybridNitroCompass.swift +473 -0
- package/lib/commonjs/hook.js +69 -0
- package/lib/commonjs/hook.js.map +1 -0
- package/lib/commonjs/index.js +39 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/multiplex.js +109 -0
- package/lib/commonjs/multiplex.js.map +1 -0
- package/lib/commonjs/native.js +9 -0
- package/lib/commonjs/native.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/NitroCompass.nitro.js +6 -0
- package/lib/commonjs/specs/NitroCompass.nitro.js.map +1 -0
- package/lib/module/hook.js +65 -0
- package/lib/module/hook.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/multiplex.js +103 -0
- package/lib/module/multiplex.js.map +1 -0
- package/lib/module/native.js +5 -0
- package/lib/module/native.js.map +1 -0
- package/lib/module/specs/NitroCompass.nitro.js +4 -0
- package/lib/module/specs/NitroCompass.nitro.js.map +1 -0
- package/lib/typescript/src/hook.d.ts +49 -0
- package/lib/typescript/src/hook.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +8 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/multiplex.d.ts +38 -0
- package/lib/typescript/src/multiplex.d.ts.map +1 -0
- package/lib/typescript/src/native.d.ts +3 -0
- package/lib/typescript/src/native.d.ts.map +1 -0
- package/lib/typescript/src/specs/NitroCompass.nitro.d.ts +176 -0
- package/lib/typescript/src/specs/NitroCompass.nitro.d.ts.map +1 -0
- package/nitro.json +30 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroCompass+autolinking.cmake +81 -0
- package/nitrogen/generated/android/NitroCompass+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroCompassOnLoad.cpp +60 -0
- package/nitrogen/generated/android/NitroCompassOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JAccuracyQuality.hpp +64 -0
- package/nitrogen/generated/android/c++/JCompassSample.hpp +61 -0
- package/nitrogen/generated/android/c++/JFunc_void_AccuracyQuality.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_CompassSample.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +75 -0
- package/nitrogen/generated/android/c++/JHybridNitroCompassSpec.cpp +143 -0
- package/nitrogen/generated/android/c++/JHybridNitroCompassSpec.hpp +75 -0
- package/nitrogen/generated/android/c++/JPermissionStatus.hpp +61 -0
- package/nitrogen/generated/android/c++/JSensorDiagnostics.hpp +58 -0
- package/nitrogen/generated/android/c++/JSensorKind.hpp +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocompass/AccuracyQuality.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocompass/CompassSample.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocompass/Func_void_AccuracyQuality.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocompass/Func_void_CompassSample.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocompass/Func_void_bool.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocompass/HybridNitroCompassSpec.kt +118 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocompass/NitroCompassOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocompass/PermissionStatus.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocompass/SensorDiagnostics.kt +51 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrocompass/SensorKind.kt +24 -0
- package/nitrogen/generated/ios/NitroCompass+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroCompass-Swift-Cxx-Bridge.cpp +73 -0
- package/nitrogen/generated/ios/NitroCompass-Swift-Cxx-Bridge.hpp +267 -0
- package/nitrogen/generated/ios/NitroCompass-Swift-Cxx-Umbrella.hpp +61 -0
- package/nitrogen/generated/ios/NitroCompassAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroCompassAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridNitroCompassSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroCompassSpecSwift.hpp +180 -0
- package/nitrogen/generated/ios/swift/AccuracyQuality.swift +48 -0
- package/nitrogen/generated/ios/swift/CompassSample.swift +34 -0
- package/nitrogen/generated/ios/swift/Func_void_AccuracyQuality.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_CompassSample.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_PermissionStatus.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridNitroCompassSpec.swift +67 -0
- package/nitrogen/generated/ios/swift/HybridNitroCompassSpec_cxx.swift +309 -0
- package/nitrogen/generated/ios/swift/PermissionStatus.swift +44 -0
- package/nitrogen/generated/ios/swift/SensorDiagnostics.swift +29 -0
- package/nitrogen/generated/ios/swift/SensorKind.swift +44 -0
- package/nitrogen/generated/shared/c++/AccuracyQuality.hpp +84 -0
- package/nitrogen/generated/shared/c++/CompassSample.hpp +87 -0
- package/nitrogen/generated/shared/c++/HybridNitroCompassSpec.cpp +33 -0
- package/nitrogen/generated/shared/c++/HybridNitroCompassSpec.hpp +87 -0
- package/nitrogen/generated/shared/c++/PermissionStatus.hpp +80 -0
- package/nitrogen/generated/shared/c++/SensorDiagnostics.hpp +84 -0
- package/nitrogen/generated/shared/c++/SensorKind.hpp +80 -0
- package/package.json +136 -0
- package/react-native.config.js +11 -0
- package/src/hook.ts +118 -0
- package/src/index.ts +28 -0
- package/src/multiplex.ts +117 -0
- package/src/native.ts +5 -0
- package/src/specs/NitroCompass.nitro.ts +193 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroCompass-Swift-Cxx-Bridge.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `AccuracyQuality` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nitrocompass { enum class AccuracyQuality; }
|
|
13
|
+
// Forward declaration of `CompassSample` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::nitrocompass { struct CompassSample; }
|
|
15
|
+
// Forward declaration of `HybridNitroCompassSpec` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitrocompass { class HybridNitroCompassSpec; }
|
|
17
|
+
// Forward declaration of `PermissionStatus` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitrocompass { enum class PermissionStatus; }
|
|
19
|
+
// Forward declaration of `SensorDiagnostics` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nitrocompass { struct SensorDiagnostics; }
|
|
21
|
+
// Forward declaration of `SensorKind` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitrocompass { enum class SensorKind; }
|
|
23
|
+
|
|
24
|
+
// Forward declarations of Swift defined types
|
|
25
|
+
// Forward declaration of `HybridNitroCompassSpec_cxx` to properly resolve imports.
|
|
26
|
+
namespace NitroCompass { class HybridNitroCompassSpec_cxx; }
|
|
27
|
+
|
|
28
|
+
// Include C++ defined types
|
|
29
|
+
#include "AccuracyQuality.hpp"
|
|
30
|
+
#include "CompassSample.hpp"
|
|
31
|
+
#include "HybridNitroCompassSpec.hpp"
|
|
32
|
+
#include "PermissionStatus.hpp"
|
|
33
|
+
#include "SensorDiagnostics.hpp"
|
|
34
|
+
#include "SensorKind.hpp"
|
|
35
|
+
#include <NitroModules/Promise.hpp>
|
|
36
|
+
#include <NitroModules/PromiseHolder.hpp>
|
|
37
|
+
#include <NitroModules/Result.hpp>
|
|
38
|
+
#include <exception>
|
|
39
|
+
#include <functional>
|
|
40
|
+
#include <memory>
|
|
41
|
+
#include <optional>
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
45
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
46
|
+
*/
|
|
47
|
+
namespace margelo::nitro::nitrocompass::bridge::swift {
|
|
48
|
+
|
|
49
|
+
// pragma MARK: std::function<void(const CompassSample& /* sample */)>
|
|
50
|
+
/**
|
|
51
|
+
* Specialized version of `std::function<void(const CompassSample&)>`.
|
|
52
|
+
*/
|
|
53
|
+
using Func_void_CompassSample = std::function<void(const CompassSample& /* sample */)>;
|
|
54
|
+
/**
|
|
55
|
+
* Wrapper class for a `std::function<void(const CompassSample& / * sample * /)>`, this can be used from Swift.
|
|
56
|
+
*/
|
|
57
|
+
class Func_void_CompassSample_Wrapper final {
|
|
58
|
+
public:
|
|
59
|
+
explicit Func_void_CompassSample_Wrapper(std::function<void(const CompassSample& /* sample */)>&& func): _function(std::make_unique<std::function<void(const CompassSample& /* sample */)>>(std::move(func))) {}
|
|
60
|
+
inline void call(CompassSample sample) const noexcept {
|
|
61
|
+
_function->operator()(sample);
|
|
62
|
+
}
|
|
63
|
+
private:
|
|
64
|
+
std::unique_ptr<std::function<void(const CompassSample& /* sample */)>> _function;
|
|
65
|
+
} SWIFT_NONCOPYABLE;
|
|
66
|
+
Func_void_CompassSample create_Func_void_CompassSample(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
67
|
+
inline Func_void_CompassSample_Wrapper wrap_Func_void_CompassSample(Func_void_CompassSample value) noexcept {
|
|
68
|
+
return Func_void_CompassSample_Wrapper(std::move(value));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// pragma MARK: std::optional<SensorDiagnostics>
|
|
72
|
+
/**
|
|
73
|
+
* Specialized version of `std::optional<SensorDiagnostics>`.
|
|
74
|
+
*/
|
|
75
|
+
using std__optional_SensorDiagnostics_ = std::optional<SensorDiagnostics>;
|
|
76
|
+
inline std::optional<SensorDiagnostics> create_std__optional_SensorDiagnostics_(const SensorDiagnostics& value) noexcept {
|
|
77
|
+
return std::optional<SensorDiagnostics>(value);
|
|
78
|
+
}
|
|
79
|
+
inline bool has_value_std__optional_SensorDiagnostics_(const std::optional<SensorDiagnostics>& optional) noexcept {
|
|
80
|
+
return optional.has_value();
|
|
81
|
+
}
|
|
82
|
+
inline SensorDiagnostics get_std__optional_SensorDiagnostics_(const std::optional<SensorDiagnostics>& optional) noexcept {
|
|
83
|
+
return optional.value();
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// pragma MARK: std::optional<CompassSample>
|
|
87
|
+
/**
|
|
88
|
+
* Specialized version of `std::optional<CompassSample>`.
|
|
89
|
+
*/
|
|
90
|
+
using std__optional_CompassSample_ = std::optional<CompassSample>;
|
|
91
|
+
inline std::optional<CompassSample> create_std__optional_CompassSample_(const CompassSample& value) noexcept {
|
|
92
|
+
return std::optional<CompassSample>(value);
|
|
93
|
+
}
|
|
94
|
+
inline bool has_value_std__optional_CompassSample_(const std::optional<CompassSample>& optional) noexcept {
|
|
95
|
+
return optional.has_value();
|
|
96
|
+
}
|
|
97
|
+
inline CompassSample get_std__optional_CompassSample_(const std::optional<CompassSample>& optional) noexcept {
|
|
98
|
+
return optional.value();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// pragma MARK: std::function<void(AccuracyQuality /* quality */)>
|
|
102
|
+
/**
|
|
103
|
+
* Specialized version of `std::function<void(AccuracyQuality)>`.
|
|
104
|
+
*/
|
|
105
|
+
using Func_void_AccuracyQuality = std::function<void(AccuracyQuality /* quality */)>;
|
|
106
|
+
/**
|
|
107
|
+
* Wrapper class for a `std::function<void(AccuracyQuality / * quality * /)>`, this can be used from Swift.
|
|
108
|
+
*/
|
|
109
|
+
class Func_void_AccuracyQuality_Wrapper final {
|
|
110
|
+
public:
|
|
111
|
+
explicit Func_void_AccuracyQuality_Wrapper(std::function<void(AccuracyQuality /* quality */)>&& func): _function(std::make_unique<std::function<void(AccuracyQuality /* quality */)>>(std::move(func))) {}
|
|
112
|
+
inline void call(int quality) const noexcept {
|
|
113
|
+
_function->operator()(static_cast<AccuracyQuality>(quality));
|
|
114
|
+
}
|
|
115
|
+
private:
|
|
116
|
+
std::unique_ptr<std::function<void(AccuracyQuality /* quality */)>> _function;
|
|
117
|
+
} SWIFT_NONCOPYABLE;
|
|
118
|
+
Func_void_AccuracyQuality create_Func_void_AccuracyQuality(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
119
|
+
inline Func_void_AccuracyQuality_Wrapper wrap_Func_void_AccuracyQuality(Func_void_AccuracyQuality value) noexcept {
|
|
120
|
+
return Func_void_AccuracyQuality_Wrapper(std::move(value));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// pragma MARK: std::function<void(bool /* interferenceDetected */)>
|
|
124
|
+
/**
|
|
125
|
+
* Specialized version of `std::function<void(bool)>`.
|
|
126
|
+
*/
|
|
127
|
+
using Func_void_bool = std::function<void(bool /* interferenceDetected */)>;
|
|
128
|
+
/**
|
|
129
|
+
* Wrapper class for a `std::function<void(bool / * interferenceDetected * /)>`, this can be used from Swift.
|
|
130
|
+
*/
|
|
131
|
+
class Func_void_bool_Wrapper final {
|
|
132
|
+
public:
|
|
133
|
+
explicit Func_void_bool_Wrapper(std::function<void(bool /* interferenceDetected */)>&& func): _function(std::make_unique<std::function<void(bool /* interferenceDetected */)>>(std::move(func))) {}
|
|
134
|
+
inline void call(bool interferenceDetected) const noexcept {
|
|
135
|
+
_function->operator()(interferenceDetected);
|
|
136
|
+
}
|
|
137
|
+
private:
|
|
138
|
+
std::unique_ptr<std::function<void(bool /* interferenceDetected */)>> _function;
|
|
139
|
+
} SWIFT_NONCOPYABLE;
|
|
140
|
+
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
141
|
+
inline Func_void_bool_Wrapper wrap_Func_void_bool(Func_void_bool value) noexcept {
|
|
142
|
+
return Func_void_bool_Wrapper(std::move(value));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// pragma MARK: std::shared_ptr<Promise<PermissionStatus>>
|
|
146
|
+
/**
|
|
147
|
+
* Specialized version of `std::shared_ptr<Promise<PermissionStatus>>`.
|
|
148
|
+
*/
|
|
149
|
+
using std__shared_ptr_Promise_PermissionStatus__ = std::shared_ptr<Promise<PermissionStatus>>;
|
|
150
|
+
inline std::shared_ptr<Promise<PermissionStatus>> create_std__shared_ptr_Promise_PermissionStatus__() noexcept {
|
|
151
|
+
return Promise<PermissionStatus>::create();
|
|
152
|
+
}
|
|
153
|
+
inline PromiseHolder<PermissionStatus> wrap_std__shared_ptr_Promise_PermissionStatus__(std::shared_ptr<Promise<PermissionStatus>> promise) noexcept {
|
|
154
|
+
return PromiseHolder<PermissionStatus>(std::move(promise));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// pragma MARK: std::function<void(PermissionStatus /* result */)>
|
|
158
|
+
/**
|
|
159
|
+
* Specialized version of `std::function<void(PermissionStatus)>`.
|
|
160
|
+
*/
|
|
161
|
+
using Func_void_PermissionStatus = std::function<void(PermissionStatus /* result */)>;
|
|
162
|
+
/**
|
|
163
|
+
* Wrapper class for a `std::function<void(PermissionStatus / * result * /)>`, this can be used from Swift.
|
|
164
|
+
*/
|
|
165
|
+
class Func_void_PermissionStatus_Wrapper final {
|
|
166
|
+
public:
|
|
167
|
+
explicit Func_void_PermissionStatus_Wrapper(std::function<void(PermissionStatus /* result */)>&& func): _function(std::make_unique<std::function<void(PermissionStatus /* result */)>>(std::move(func))) {}
|
|
168
|
+
inline void call(int result) const noexcept {
|
|
169
|
+
_function->operator()(static_cast<PermissionStatus>(result));
|
|
170
|
+
}
|
|
171
|
+
private:
|
|
172
|
+
std::unique_ptr<std::function<void(PermissionStatus /* result */)>> _function;
|
|
173
|
+
} SWIFT_NONCOPYABLE;
|
|
174
|
+
Func_void_PermissionStatus create_Func_void_PermissionStatus(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
175
|
+
inline Func_void_PermissionStatus_Wrapper wrap_Func_void_PermissionStatus(Func_void_PermissionStatus value) noexcept {
|
|
176
|
+
return Func_void_PermissionStatus_Wrapper(std::move(value));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
180
|
+
/**
|
|
181
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
182
|
+
*/
|
|
183
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
184
|
+
/**
|
|
185
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
186
|
+
*/
|
|
187
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
188
|
+
public:
|
|
189
|
+
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
190
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
191
|
+
_function->operator()(error);
|
|
192
|
+
}
|
|
193
|
+
private:
|
|
194
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
195
|
+
} SWIFT_NONCOPYABLE;
|
|
196
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
197
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
198
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// pragma MARK: std::shared_ptr<HybridNitroCompassSpec>
|
|
202
|
+
/**
|
|
203
|
+
* Specialized version of `std::shared_ptr<HybridNitroCompassSpec>`.
|
|
204
|
+
*/
|
|
205
|
+
using std__shared_ptr_HybridNitroCompassSpec_ = std::shared_ptr<HybridNitroCompassSpec>;
|
|
206
|
+
std::shared_ptr<HybridNitroCompassSpec> create_std__shared_ptr_HybridNitroCompassSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
207
|
+
void* NON_NULL get_std__shared_ptr_HybridNitroCompassSpec_(std__shared_ptr_HybridNitroCompassSpec_ cppType);
|
|
208
|
+
|
|
209
|
+
// pragma MARK: std::weak_ptr<HybridNitroCompassSpec>
|
|
210
|
+
using std__weak_ptr_HybridNitroCompassSpec_ = std::weak_ptr<HybridNitroCompassSpec>;
|
|
211
|
+
inline std__weak_ptr_HybridNitroCompassSpec_ weakify_std__shared_ptr_HybridNitroCompassSpec_(const std::shared_ptr<HybridNitroCompassSpec>& strong) noexcept { return strong; }
|
|
212
|
+
|
|
213
|
+
// pragma MARK: Result<void>
|
|
214
|
+
using Result_void_ = Result<void>;
|
|
215
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
216
|
+
return Result<void>::withValue();
|
|
217
|
+
}
|
|
218
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
219
|
+
return Result<void>::withError(error);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// pragma MARK: Result<bool>
|
|
223
|
+
using Result_bool_ = Result<bool>;
|
|
224
|
+
inline Result_bool_ create_Result_bool_(bool value) noexcept {
|
|
225
|
+
return Result<bool>::withValue(std::move(value));
|
|
226
|
+
}
|
|
227
|
+
inline Result_bool_ create_Result_bool_(const std::exception_ptr& error) noexcept {
|
|
228
|
+
return Result<bool>::withError(error);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// pragma MARK: Result<std::optional<SensorDiagnostics>>
|
|
232
|
+
using Result_std__optional_SensorDiagnostics__ = Result<std::optional<SensorDiagnostics>>;
|
|
233
|
+
inline Result_std__optional_SensorDiagnostics__ create_Result_std__optional_SensorDiagnostics__(const std::optional<SensorDiagnostics>& value) noexcept {
|
|
234
|
+
return Result<std::optional<SensorDiagnostics>>::withValue(value);
|
|
235
|
+
}
|
|
236
|
+
inline Result_std__optional_SensorDiagnostics__ create_Result_std__optional_SensorDiagnostics__(const std::exception_ptr& error) noexcept {
|
|
237
|
+
return Result<std::optional<SensorDiagnostics>>::withError(error);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// pragma MARK: Result<std::optional<CompassSample>>
|
|
241
|
+
using Result_std__optional_CompassSample__ = Result<std::optional<CompassSample>>;
|
|
242
|
+
inline Result_std__optional_CompassSample__ create_Result_std__optional_CompassSample__(const std::optional<CompassSample>& value) noexcept {
|
|
243
|
+
return Result<std::optional<CompassSample>>::withValue(value);
|
|
244
|
+
}
|
|
245
|
+
inline Result_std__optional_CompassSample__ create_Result_std__optional_CompassSample__(const std::exception_ptr& error) noexcept {
|
|
246
|
+
return Result<std::optional<CompassSample>>::withError(error);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// pragma MARK: Result<PermissionStatus>
|
|
250
|
+
using Result_PermissionStatus_ = Result<PermissionStatus>;
|
|
251
|
+
inline Result_PermissionStatus_ create_Result_PermissionStatus_(PermissionStatus value) noexcept {
|
|
252
|
+
return Result<PermissionStatus>::withValue(std::move(value));
|
|
253
|
+
}
|
|
254
|
+
inline Result_PermissionStatus_ create_Result_PermissionStatus_(const std::exception_ptr& error) noexcept {
|
|
255
|
+
return Result<PermissionStatus>::withError(error);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// pragma MARK: Result<std::shared_ptr<Promise<PermissionStatus>>>
|
|
259
|
+
using Result_std__shared_ptr_Promise_PermissionStatus___ = Result<std::shared_ptr<Promise<PermissionStatus>>>;
|
|
260
|
+
inline Result_std__shared_ptr_Promise_PermissionStatus___ create_Result_std__shared_ptr_Promise_PermissionStatus___(const std::shared_ptr<Promise<PermissionStatus>>& value) noexcept {
|
|
261
|
+
return Result<std::shared_ptr<Promise<PermissionStatus>>>::withValue(value);
|
|
262
|
+
}
|
|
263
|
+
inline Result_std__shared_ptr_Promise_PermissionStatus___ create_Result_std__shared_ptr_Promise_PermissionStatus___(const std::exception_ptr& error) noexcept {
|
|
264
|
+
return Result<std::shared_ptr<Promise<PermissionStatus>>>::withError(error);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
} // namespace margelo::nitro::nitrocompass::bridge::swift
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroCompass-Swift-Cxx-Umbrella.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `AccuracyQuality` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nitrocompass { enum class AccuracyQuality; }
|
|
13
|
+
// Forward declaration of `CompassSample` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::nitrocompass { struct CompassSample; }
|
|
15
|
+
// Forward declaration of `HybridNitroCompassSpec` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitrocompass { class HybridNitroCompassSpec; }
|
|
17
|
+
// Forward declaration of `PermissionStatus` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitrocompass { enum class PermissionStatus; }
|
|
19
|
+
// Forward declaration of `SensorDiagnostics` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nitrocompass { struct SensorDiagnostics; }
|
|
21
|
+
// Forward declaration of `SensorKind` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitrocompass { enum class SensorKind; }
|
|
23
|
+
|
|
24
|
+
// Include C++ defined types
|
|
25
|
+
#include "AccuracyQuality.hpp"
|
|
26
|
+
#include "CompassSample.hpp"
|
|
27
|
+
#include "HybridNitroCompassSpec.hpp"
|
|
28
|
+
#include "PermissionStatus.hpp"
|
|
29
|
+
#include "SensorDiagnostics.hpp"
|
|
30
|
+
#include "SensorKind.hpp"
|
|
31
|
+
#include <NitroModules/Promise.hpp>
|
|
32
|
+
#include <NitroModules/Result.hpp>
|
|
33
|
+
#include <exception>
|
|
34
|
+
#include <functional>
|
|
35
|
+
#include <memory>
|
|
36
|
+
#include <optional>
|
|
37
|
+
|
|
38
|
+
// C++ helpers for Swift
|
|
39
|
+
#include "NitroCompass-Swift-Cxx-Bridge.hpp"
|
|
40
|
+
|
|
41
|
+
// Common C++ types used in Swift
|
|
42
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
43
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
44
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
45
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
46
|
+
|
|
47
|
+
// Forward declarations of Swift defined types
|
|
48
|
+
// Forward declaration of `HybridNitroCompassSpec_cxx` to properly resolve imports.
|
|
49
|
+
namespace NitroCompass { class HybridNitroCompassSpec_cxx; }
|
|
50
|
+
|
|
51
|
+
// Include Swift defined types
|
|
52
|
+
#if __has_include("NitroCompass-Swift.h")
|
|
53
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
54
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroCompass".
|
|
55
|
+
#include "NitroCompass-Swift.h"
|
|
56
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
57
|
+
#elif __has_include(<NitroCompass/NitroCompass-Swift.h>)
|
|
58
|
+
#include <NitroCompass/NitroCompass-Swift.h>
|
|
59
|
+
#else
|
|
60
|
+
#error NitroCompass's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroCompass", and try building the app first.
|
|
61
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroCompassAutolinking.mm
|
|
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 <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "NitroCompass-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridNitroCompassSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface NitroCompassAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation NitroCompassAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::nitrocompass;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"NitroCompass",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridNitroCompassSpec> hybridObject = NitroCompass::NitroCompassAutolinking::createNitroCompass();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroCompassAutolinking.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
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class NitroCompassAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.nitrocompass.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createNitroCompass() -> bridge.std__shared_ptr_HybridNitroCompassSpec_ {
|
|
16
|
+
let hybridObject = HybridNitroCompass()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridNitroCompassSpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isNitroCompassRecyclable() -> Bool {
|
|
24
|
+
return HybridNitroCompass.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroCompassSpecSwift.cpp
|
|
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
|
+
#include "HybridNitroCompassSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitrocompass {
|
|
11
|
+
} // namespace margelo::nitro::nitrocompass
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNitroCompassSpecSwift.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridNitroCompassSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridNitroCompassSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace NitroCompass { class HybridNitroCompassSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `CompassSample` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitrocompass { struct CompassSample; }
|
|
17
|
+
// Forward declaration of `SensorDiagnostics` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitrocompass { struct SensorDiagnostics; }
|
|
19
|
+
// Forward declaration of `SensorKind` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nitrocompass { enum class SensorKind; }
|
|
21
|
+
// Forward declaration of `AccuracyQuality` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitrocompass { enum class AccuracyQuality; }
|
|
23
|
+
// Forward declaration of `PermissionStatus` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::nitrocompass { enum class PermissionStatus; }
|
|
25
|
+
|
|
26
|
+
#include "CompassSample.hpp"
|
|
27
|
+
#include <functional>
|
|
28
|
+
#include "SensorDiagnostics.hpp"
|
|
29
|
+
#include <optional>
|
|
30
|
+
#include "SensorKind.hpp"
|
|
31
|
+
#include "AccuracyQuality.hpp"
|
|
32
|
+
#include "PermissionStatus.hpp"
|
|
33
|
+
#include <NitroModules/Promise.hpp>
|
|
34
|
+
|
|
35
|
+
#include "NitroCompass-Swift-Cxx-Umbrella.hpp"
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::nitrocompass {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The C++ part of HybridNitroCompassSpec_cxx.swift.
|
|
41
|
+
*
|
|
42
|
+
* HybridNitroCompassSpecSwift (C++) accesses HybridNitroCompassSpec_cxx (Swift), and might
|
|
43
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
44
|
+
*
|
|
45
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
46
|
+
* the future, HybridNitroCompassSpec_cxx can directly inherit from the C++ class HybridNitroCompassSpec
|
|
47
|
+
* to simplify the whole structure and memory management.
|
|
48
|
+
*/
|
|
49
|
+
class HybridNitroCompassSpecSwift: public virtual HybridNitroCompassSpec {
|
|
50
|
+
public:
|
|
51
|
+
// Constructor from a Swift instance
|
|
52
|
+
explicit HybridNitroCompassSpecSwift(const NitroCompass::HybridNitroCompassSpec_cxx& swiftPart):
|
|
53
|
+
HybridObject(HybridNitroCompassSpec::TAG),
|
|
54
|
+
_swiftPart(swiftPart) { }
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
// Get the Swift part
|
|
58
|
+
inline NitroCompass::HybridNitroCompassSpec_cxx& getSwiftPart() noexcept {
|
|
59
|
+
return _swiftPart;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public:
|
|
63
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
64
|
+
return _swiftPart.getMemorySize();
|
|
65
|
+
}
|
|
66
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
67
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridNitroCompassSpecSwift>(other)) {
|
|
68
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
69
|
+
}
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
void dispose() noexcept override {
|
|
73
|
+
_swiftPart.dispose();
|
|
74
|
+
}
|
|
75
|
+
std::string toString() override {
|
|
76
|
+
return _swiftPart.toString();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public:
|
|
80
|
+
// Properties
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
public:
|
|
84
|
+
// Methods
|
|
85
|
+
inline void start(double filterDegrees, const std::function<void(const CompassSample& /* sample */)>& onHeading) override {
|
|
86
|
+
auto __result = _swiftPart.start(std::forward<decltype(filterDegrees)>(filterDegrees), onHeading);
|
|
87
|
+
if (__result.hasError()) [[unlikely]] {
|
|
88
|
+
std::rethrow_exception(__result.error());
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
inline void stop() override {
|
|
92
|
+
auto __result = _swiftPart.stop();
|
|
93
|
+
if (__result.hasError()) [[unlikely]] {
|
|
94
|
+
std::rethrow_exception(__result.error());
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
inline bool isStarted() override {
|
|
98
|
+
auto __result = _swiftPart.isStarted();
|
|
99
|
+
if (__result.hasError()) [[unlikely]] {
|
|
100
|
+
std::rethrow_exception(__result.error());
|
|
101
|
+
}
|
|
102
|
+
auto __value = std::move(__result.value());
|
|
103
|
+
return __value;
|
|
104
|
+
}
|
|
105
|
+
inline void setFilter(double degrees) override {
|
|
106
|
+
auto __result = _swiftPart.setFilter(std::forward<decltype(degrees)>(degrees));
|
|
107
|
+
if (__result.hasError()) [[unlikely]] {
|
|
108
|
+
std::rethrow_exception(__result.error());
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
inline std::optional<SensorDiagnostics> getDiagnostics() override {
|
|
112
|
+
auto __result = _swiftPart.getDiagnostics();
|
|
113
|
+
if (__result.hasError()) [[unlikely]] {
|
|
114
|
+
std::rethrow_exception(__result.error());
|
|
115
|
+
}
|
|
116
|
+
auto __value = std::move(__result.value());
|
|
117
|
+
return __value;
|
|
118
|
+
}
|
|
119
|
+
inline bool hasCompass() override {
|
|
120
|
+
auto __result = _swiftPart.hasCompass();
|
|
121
|
+
if (__result.hasError()) [[unlikely]] {
|
|
122
|
+
std::rethrow_exception(__result.error());
|
|
123
|
+
}
|
|
124
|
+
auto __value = std::move(__result.value());
|
|
125
|
+
return __value;
|
|
126
|
+
}
|
|
127
|
+
inline std::optional<CompassSample> getCurrentHeading() override {
|
|
128
|
+
auto __result = _swiftPart.getCurrentHeading();
|
|
129
|
+
if (__result.hasError()) [[unlikely]] {
|
|
130
|
+
std::rethrow_exception(__result.error());
|
|
131
|
+
}
|
|
132
|
+
auto __value = std::move(__result.value());
|
|
133
|
+
return __value;
|
|
134
|
+
}
|
|
135
|
+
inline void setDeclination(double degrees) override {
|
|
136
|
+
auto __result = _swiftPart.setDeclination(std::forward<decltype(degrees)>(degrees));
|
|
137
|
+
if (__result.hasError()) [[unlikely]] {
|
|
138
|
+
std::rethrow_exception(__result.error());
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
inline void setOnCalibrationNeeded(const std::function<void(AccuracyQuality /* quality */)>& onChange) override {
|
|
142
|
+
auto __result = _swiftPart.setOnCalibrationNeeded(onChange);
|
|
143
|
+
if (__result.hasError()) [[unlikely]] {
|
|
144
|
+
std::rethrow_exception(__result.error());
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
inline void setOnInterferenceDetected(const std::function<void(bool /* interferenceDetected */)>& onChange) override {
|
|
148
|
+
auto __result = _swiftPart.setOnInterferenceDetected(onChange);
|
|
149
|
+
if (__result.hasError()) [[unlikely]] {
|
|
150
|
+
std::rethrow_exception(__result.error());
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
inline void setPauseOnBackground(bool enabled) override {
|
|
154
|
+
auto __result = _swiftPart.setPauseOnBackground(std::forward<decltype(enabled)>(enabled));
|
|
155
|
+
if (__result.hasError()) [[unlikely]] {
|
|
156
|
+
std::rethrow_exception(__result.error());
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
inline PermissionStatus getPermissionStatus() override {
|
|
160
|
+
auto __result = _swiftPart.getPermissionStatus();
|
|
161
|
+
if (__result.hasError()) [[unlikely]] {
|
|
162
|
+
std::rethrow_exception(__result.error());
|
|
163
|
+
}
|
|
164
|
+
auto __value = std::move(__result.value());
|
|
165
|
+
return __value;
|
|
166
|
+
}
|
|
167
|
+
inline std::shared_ptr<Promise<PermissionStatus>> requestPermission() override {
|
|
168
|
+
auto __result = _swiftPart.requestPermission();
|
|
169
|
+
if (__result.hasError()) [[unlikely]] {
|
|
170
|
+
std::rethrow_exception(__result.error());
|
|
171
|
+
}
|
|
172
|
+
auto __value = std::move(__result.value());
|
|
173
|
+
return __value;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
private:
|
|
177
|
+
NitroCompass::HybridNitroCompassSpec_cxx _swiftPart;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
} // namespace margelo::nitro::nitrocompass
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AccuracyQuality.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
|
+
/**
|
|
9
|
+
* Represents the JS union `AccuracyQuality`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias AccuracyQuality = margelo.nitro.nitrocompass.AccuracyQuality
|
|
12
|
+
|
|
13
|
+
public extension AccuracyQuality {
|
|
14
|
+
/**
|
|
15
|
+
* Get a AccuracyQuality for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "high":
|
|
21
|
+
self = .high
|
|
22
|
+
case "medium":
|
|
23
|
+
self = .medium
|
|
24
|
+
case "low":
|
|
25
|
+
self = .low
|
|
26
|
+
case "unreliable":
|
|
27
|
+
self = .unreliable
|
|
28
|
+
default:
|
|
29
|
+
return nil
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Get the String value this AccuracyQuality represents.
|
|
35
|
+
*/
|
|
36
|
+
var stringValue: String {
|
|
37
|
+
switch self {
|
|
38
|
+
case .high:
|
|
39
|
+
return "high"
|
|
40
|
+
case .medium:
|
|
41
|
+
return "medium"
|
|
42
|
+
case .low:
|
|
43
|
+
return "low"
|
|
44
|
+
case .unreliable:
|
|
45
|
+
return "unreliable"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CompassSample.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
|
+
* Represents an instance of `CompassSample`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias CompassSample = margelo.nitro.nitrocompass.CompassSample
|
|
14
|
+
|
|
15
|
+
public extension CompassSample {
|
|
16
|
+
private typealias bridge = margelo.nitro.nitrocompass.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `CompassSample`.
|
|
20
|
+
*/
|
|
21
|
+
init(heading: Double, accuracy: Double) {
|
|
22
|
+
self.init(heading, accuracy)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var heading: Double {
|
|
27
|
+
return self.__heading
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var accuracy: Double {
|
|
32
|
+
return self.__accuracy
|
|
33
|
+
}
|
|
34
|
+
}
|