@onekeyfe/react-native-chart-webview 3.0.39
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/ChartWebview.podspec +29 -0
- package/LICENSE +21 -0
- package/README.md +31 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +131 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/chartwebview/ChartWebview.kt +331 -0
- package/android/src/main/java/com/margelo/nitro/chartwebview/ChartWebviewPackage.kt +29 -0
- package/android/src/main/java/com/margelo/nitro/chartwebview/PooledChartWebView.kt +385 -0
- package/ios/ChartWebview.swift +747 -0
- package/lib/module/ChartWebview.nitro.js +4 -0
- package/lib/module/ChartWebview.nitro.js.map +1 -0
- package/lib/module/bridge.js +30 -0
- package/lib/module/bridge.js.map +1 -0
- package/lib/module/index.js +19 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/lib/nitrogen/generated/android/c++/JHybridChartWebviewSpec.cpp +186 -0
- package/lib/nitrogen/generated/android/c++/JHybridChartWebviewSpec.hpp +88 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.cpp +96 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.hpp +49 -0
- package/lib/nitrogen/generated/android/chartwebview+autolinking.cmake +83 -0
- package/lib/nitrogen/generated/android/chartwebview+autolinking.gradle +27 -0
- package/lib/nitrogen/generated/android/chartwebviewOnLoad.cpp +50 -0
- package/lib/nitrogen/generated/android/chartwebviewOnLoad.hpp +25 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/Func_void.kt +80 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/Func_void_std__string.kt +80 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/HybridChartWebviewSpec.kt +153 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/chartwebviewOnLoad.kt +35 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/views/HybridChartWebviewManager.kt +50 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/views/HybridChartWebviewStateUpdater.kt +23 -0
- package/lib/nitrogen/generated/ios/ChartWebview+autolinking.rb +60 -0
- package/lib/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Bridge.cpp +49 -0
- package/lib/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Bridge.hpp +158 -0
- package/lib/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Umbrella.hpp +46 -0
- package/lib/nitrogen/generated/ios/ChartWebviewAutolinking.mm +33 -0
- package/lib/nitrogen/generated/ios/ChartWebviewAutolinking.swift +25 -0
- package/lib/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.cpp +11 -0
- package/lib/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.hpp +164 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridChartWebviewComponent.mm +146 -0
- package/lib/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/lib/nitrogen/generated/ios/swift/HybridChartWebviewSpec.swift +68 -0
- package/lib/nitrogen/generated/ios/swift/HybridChartWebviewSpec_cxx.swift +450 -0
- package/lib/nitrogen/generated/shared/c++/HybridChartWebviewSpec.cpp +45 -0
- package/lib/nitrogen/generated/shared/c++/HybridChartWebviewSpec.hpp +87 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.cpp +207 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.hpp +118 -0
- package/lib/nitrogen/generated/shared/json/ChartWebviewConfig.json +20 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/JHybridChartWebviewSpec.cpp +186 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/JHybridChartWebviewSpec.hpp +88 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.cpp +96 -0
- package/lib/nitrogen/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.hpp +49 -0
- package/lib/nitrogen/nitrogen/generated/android/chartwebview+autolinking.cmake +83 -0
- package/lib/nitrogen/nitrogen/generated/android/chartwebview+autolinking.gradle +27 -0
- package/lib/nitrogen/nitrogen/generated/android/chartwebviewOnLoad.cpp +50 -0
- package/lib/nitrogen/nitrogen/generated/android/chartwebviewOnLoad.hpp +25 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/Func_void.kt +80 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/Func_void_std__string.kt +80 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/HybridChartWebviewSpec.kt +153 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/chartwebviewOnLoad.kt +35 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/views/HybridChartWebviewManager.kt +50 -0
- package/lib/nitrogen/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/views/HybridChartWebviewStateUpdater.kt +23 -0
- package/lib/nitrogen/nitrogen/generated/ios/ChartWebview+autolinking.rb +60 -0
- package/lib/nitrogen/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Bridge.cpp +49 -0
- package/lib/nitrogen/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Bridge.hpp +158 -0
- package/lib/nitrogen/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Umbrella.hpp +46 -0
- package/lib/nitrogen/nitrogen/generated/ios/ChartWebviewAutolinking.mm +33 -0
- package/lib/nitrogen/nitrogen/generated/ios/ChartWebviewAutolinking.swift +25 -0
- package/lib/nitrogen/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.cpp +11 -0
- package/lib/nitrogen/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.hpp +164 -0
- package/lib/nitrogen/nitrogen/generated/ios/c++/views/HybridChartWebviewComponent.mm +146 -0
- package/lib/nitrogen/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/lib/nitrogen/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/lib/nitrogen/nitrogen/generated/ios/swift/HybridChartWebviewSpec.swift +68 -0
- package/lib/nitrogen/nitrogen/generated/ios/swift/HybridChartWebviewSpec_cxx.swift +450 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/HybridChartWebviewSpec.cpp +45 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/HybridChartWebviewSpec.hpp +87 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.cpp +207 -0
- package/lib/nitrogen/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.hpp +118 -0
- package/lib/nitrogen/nitrogen/generated/shared/json/ChartWebviewConfig.json +20 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/ChartWebview.nitro.d.ts +21 -0
- package/lib/typescript/src/ChartWebview.nitro.d.ts.map +1 -0
- package/lib/typescript/src/bridge.d.ts +2 -0
- package/lib/typescript/src/bridge.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +145 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridChartWebviewSpec.cpp +186 -0
- package/nitrogen/generated/android/c++/JHybridChartWebviewSpec.hpp +88 -0
- package/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.cpp +96 -0
- package/nitrogen/generated/android/c++/views/JHybridChartWebviewStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/chartwebview+autolinking.cmake +83 -0
- package/nitrogen/generated/android/chartwebview+autolinking.gradle +27 -0
- package/nitrogen/generated/android/chartwebviewOnLoad.cpp +50 -0
- package/nitrogen/generated/android/chartwebviewOnLoad.hpp +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/Func_void_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/HybridChartWebviewSpec.kt +153 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/chartwebviewOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/views/HybridChartWebviewManager.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/chartwebview/views/HybridChartWebviewStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/ChartWebview+autolinking.rb +60 -0
- package/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Bridge.cpp +49 -0
- package/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Bridge.hpp +158 -0
- package/nitrogen/generated/ios/ChartWebview-Swift-Cxx-Umbrella.hpp +46 -0
- package/nitrogen/generated/ios/ChartWebviewAutolinking.mm +33 -0
- package/nitrogen/generated/ios/ChartWebviewAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridChartWebviewSpecSwift.hpp +164 -0
- package/nitrogen/generated/ios/c++/views/HybridChartWebviewComponent.mm +146 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridChartWebviewSpec.swift +68 -0
- package/nitrogen/generated/ios/swift/HybridChartWebviewSpec_cxx.swift +450 -0
- package/nitrogen/generated/shared/c++/HybridChartWebviewSpec.cpp +45 -0
- package/nitrogen/generated/shared/c++/HybridChartWebviewSpec.hpp +87 -0
- package/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.cpp +207 -0
- package/nitrogen/generated/shared/c++/views/HybridChartWebviewComponent.hpp +118 -0
- package/nitrogen/generated/shared/json/ChartWebviewConfig.json +20 -0
- package/package.json +170 -0
- package/src/ChartWebview.nitro.ts +59 -0
- package/src/bridge.ts +27 -0
- package/src/index.tsx +20 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ChartWebview-Swift-Cxx-Bridge.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridChartWebviewSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::chartwebview { class HybridChartWebviewSpec; }
|
|
13
|
+
|
|
14
|
+
// Forward declarations of Swift defined types
|
|
15
|
+
// Forward declaration of `HybridChartWebviewSpec_cxx` to properly resolve imports.
|
|
16
|
+
namespace ChartWebview { class HybridChartWebviewSpec_cxx; }
|
|
17
|
+
|
|
18
|
+
// Include C++ defined types
|
|
19
|
+
#include "HybridChartWebviewSpec.hpp"
|
|
20
|
+
#include <NitroModules/Result.hpp>
|
|
21
|
+
#include <exception>
|
|
22
|
+
#include <functional>
|
|
23
|
+
#include <memory>
|
|
24
|
+
#include <optional>
|
|
25
|
+
#include <string>
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
29
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
30
|
+
*/
|
|
31
|
+
namespace margelo::nitro::chartwebview::bridge::swift {
|
|
32
|
+
|
|
33
|
+
// pragma MARK: std::optional<std::string>
|
|
34
|
+
/**
|
|
35
|
+
* Specialized version of `std::optional<std::string>`.
|
|
36
|
+
*/
|
|
37
|
+
using std__optional_std__string_ = std::optional<std::string>;
|
|
38
|
+
inline std::optional<std::string> create_std__optional_std__string_(const std::string& value) noexcept {
|
|
39
|
+
return std::optional<std::string>(value);
|
|
40
|
+
}
|
|
41
|
+
inline bool has_value_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
42
|
+
return optional.has_value();
|
|
43
|
+
}
|
|
44
|
+
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
45
|
+
return *optional;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// pragma MARK: std::optional<bool>
|
|
49
|
+
/**
|
|
50
|
+
* Specialized version of `std::optional<bool>`.
|
|
51
|
+
*/
|
|
52
|
+
using std__optional_bool_ = std::optional<bool>;
|
|
53
|
+
inline std::optional<bool> create_std__optional_bool_(const bool& value) noexcept {
|
|
54
|
+
return std::optional<bool>(value);
|
|
55
|
+
}
|
|
56
|
+
inline bool has_value_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
57
|
+
return optional.has_value();
|
|
58
|
+
}
|
|
59
|
+
inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
60
|
+
return *optional;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// pragma MARK: std::function<void(const std::string& /* message */)>
|
|
64
|
+
/**
|
|
65
|
+
* Specialized version of `std::function<void(const std::string&)>`.
|
|
66
|
+
*/
|
|
67
|
+
using Func_void_std__string = std::function<void(const std::string& /* message */)>;
|
|
68
|
+
/**
|
|
69
|
+
* Wrapper class for a `std::function<void(const std::string& / * message * /)>`, this can be used from Swift.
|
|
70
|
+
*/
|
|
71
|
+
class Func_void_std__string_Wrapper final {
|
|
72
|
+
public:
|
|
73
|
+
explicit Func_void_std__string_Wrapper(std::function<void(const std::string& /* message */)>&& func): _function(std::make_unique<std::function<void(const std::string& /* message */)>>(std::move(func))) {}
|
|
74
|
+
inline void call(std::string message) const noexcept {
|
|
75
|
+
_function->operator()(message);
|
|
76
|
+
}
|
|
77
|
+
private:
|
|
78
|
+
std::unique_ptr<std::function<void(const std::string& /* message */)>> _function;
|
|
79
|
+
} SWIFT_NONCOPYABLE;
|
|
80
|
+
Func_void_std__string create_Func_void_std__string(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
81
|
+
inline Func_void_std__string_Wrapper wrap_Func_void_std__string(Func_void_std__string value) noexcept {
|
|
82
|
+
return Func_void_std__string_Wrapper(std::move(value));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// pragma MARK: std::optional<std::function<void(const std::string& /* message */)>>
|
|
86
|
+
/**
|
|
87
|
+
* Specialized version of `std::optional<std::function<void(const std::string& / * message * /)>>`.
|
|
88
|
+
*/
|
|
89
|
+
using std__optional_std__function_void_const_std__string_____message______ = std::optional<std::function<void(const std::string& /* message */)>>;
|
|
90
|
+
inline std::optional<std::function<void(const std::string& /* message */)>> create_std__optional_std__function_void_const_std__string_____message______(const std::function<void(const std::string& /* message */)>& value) noexcept {
|
|
91
|
+
return std::optional<std::function<void(const std::string& /* message */)>>(value);
|
|
92
|
+
}
|
|
93
|
+
inline bool has_value_std__optional_std__function_void_const_std__string_____message______(const std::optional<std::function<void(const std::string& /* message */)>>& optional) noexcept {
|
|
94
|
+
return optional.has_value();
|
|
95
|
+
}
|
|
96
|
+
inline std::function<void(const std::string& /* message */)> get_std__optional_std__function_void_const_std__string_____message______(const std::optional<std::function<void(const std::string& /* message */)>>& optional) noexcept {
|
|
97
|
+
return *optional;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// pragma MARK: std::function<void()>
|
|
101
|
+
/**
|
|
102
|
+
* Specialized version of `std::function<void()>`.
|
|
103
|
+
*/
|
|
104
|
+
using Func_void = std::function<void()>;
|
|
105
|
+
/**
|
|
106
|
+
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
107
|
+
*/
|
|
108
|
+
class Func_void_Wrapper final {
|
|
109
|
+
public:
|
|
110
|
+
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
111
|
+
inline void call() const noexcept {
|
|
112
|
+
_function->operator()();
|
|
113
|
+
}
|
|
114
|
+
private:
|
|
115
|
+
std::unique_ptr<std::function<void()>> _function;
|
|
116
|
+
} SWIFT_NONCOPYABLE;
|
|
117
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
118
|
+
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
119
|
+
return Func_void_Wrapper(std::move(value));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// pragma MARK: std::optional<std::function<void()>>
|
|
123
|
+
/**
|
|
124
|
+
* Specialized version of `std::optional<std::function<void()>>`.
|
|
125
|
+
*/
|
|
126
|
+
using std__optional_std__function_void____ = std::optional<std::function<void()>>;
|
|
127
|
+
inline std::optional<std::function<void()>> create_std__optional_std__function_void____(const std::function<void()>& value) noexcept {
|
|
128
|
+
return std::optional<std::function<void()>>(value);
|
|
129
|
+
}
|
|
130
|
+
inline bool has_value_std__optional_std__function_void____(const std::optional<std::function<void()>>& optional) noexcept {
|
|
131
|
+
return optional.has_value();
|
|
132
|
+
}
|
|
133
|
+
inline std::function<void()> get_std__optional_std__function_void____(const std::optional<std::function<void()>>& optional) noexcept {
|
|
134
|
+
return *optional;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// pragma MARK: std::shared_ptr<HybridChartWebviewSpec>
|
|
138
|
+
/**
|
|
139
|
+
* Specialized version of `std::shared_ptr<HybridChartWebviewSpec>`.
|
|
140
|
+
*/
|
|
141
|
+
using std__shared_ptr_HybridChartWebviewSpec_ = std::shared_ptr<HybridChartWebviewSpec>;
|
|
142
|
+
std::shared_ptr<HybridChartWebviewSpec> create_std__shared_ptr_HybridChartWebviewSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
143
|
+
void* NON_NULL get_std__shared_ptr_HybridChartWebviewSpec_(std__shared_ptr_HybridChartWebviewSpec_ cppType);
|
|
144
|
+
|
|
145
|
+
// pragma MARK: std::weak_ptr<HybridChartWebviewSpec>
|
|
146
|
+
using std__weak_ptr_HybridChartWebviewSpec_ = std::weak_ptr<HybridChartWebviewSpec>;
|
|
147
|
+
inline std__weak_ptr_HybridChartWebviewSpec_ weakify_std__shared_ptr_HybridChartWebviewSpec_(const std::shared_ptr<HybridChartWebviewSpec>& strong) noexcept { return strong; }
|
|
148
|
+
|
|
149
|
+
// pragma MARK: Result<void>
|
|
150
|
+
using Result_void_ = Result<void>;
|
|
151
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
152
|
+
return Result<void>::withValue();
|
|
153
|
+
}
|
|
154
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
155
|
+
return Result<void>::withError(error);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
} // namespace margelo::nitro::chartwebview::bridge::swift
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ChartWebview-Swift-Cxx-Umbrella.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridChartWebviewSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::chartwebview { class HybridChartWebviewSpec; }
|
|
13
|
+
|
|
14
|
+
// Include C++ defined types
|
|
15
|
+
#include "HybridChartWebviewSpec.hpp"
|
|
16
|
+
#include <NitroModules/Result.hpp>
|
|
17
|
+
#include <exception>
|
|
18
|
+
#include <functional>
|
|
19
|
+
#include <memory>
|
|
20
|
+
#include <optional>
|
|
21
|
+
#include <string>
|
|
22
|
+
|
|
23
|
+
// C++ helpers for Swift
|
|
24
|
+
#include "ChartWebview-Swift-Cxx-Bridge.hpp"
|
|
25
|
+
|
|
26
|
+
// Common C++ types used in Swift
|
|
27
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
28
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
29
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
30
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
31
|
+
|
|
32
|
+
// Forward declarations of Swift defined types
|
|
33
|
+
// Forward declaration of `HybridChartWebviewSpec_cxx` to properly resolve imports.
|
|
34
|
+
namespace ChartWebview { class HybridChartWebviewSpec_cxx; }
|
|
35
|
+
|
|
36
|
+
// Include Swift defined types
|
|
37
|
+
#if __has_include("ChartWebview-Swift.h")
|
|
38
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
39
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "ChartWebview".
|
|
40
|
+
#include "ChartWebview-Swift.h"
|
|
41
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
42
|
+
#elif __has_include(<ChartWebview/ChartWebview-Swift.h>)
|
|
43
|
+
#include <ChartWebview/ChartWebview-Swift.h>
|
|
44
|
+
#else
|
|
45
|
+
#error ChartWebview's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "ChartWebview", and try building the app first.
|
|
46
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ChartWebviewAutolinking.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "ChartWebview-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridChartWebviewSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface ChartWebviewAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation ChartWebviewAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::chartwebview;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"ChartWebview",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridChartWebviewSpec> hybridObject = ChartWebview::ChartWebviewAutolinking::createChartWebview();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ChartWebviewAutolinking.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
public final class ChartWebviewAutolinking {
|
|
9
|
+
public typealias bridge = margelo.nitro.chartwebview.bridge.swift
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of a Swift class that implements `HybridChartWebviewSpec`,
|
|
13
|
+
* and wraps it in a Swift class that can directly interop with C++ (`HybridChartWebviewSpec_cxx`)
|
|
14
|
+
*
|
|
15
|
+
* This is generated by Nitrogen and will initialize the class specified
|
|
16
|
+
* in the `"autolinking"` property of `nitro.json` (in this case, `HybridChartWebview`).
|
|
17
|
+
*/
|
|
18
|
+
public static func createChartWebview() -> bridge.std__shared_ptr_HybridChartWebviewSpec_ {
|
|
19
|
+
let hybridObject = HybridChartWebview()
|
|
20
|
+
return { () -> bridge.std__shared_ptr_HybridChartWebviewSpec_ in
|
|
21
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
22
|
+
return __cxxWrapped.getCxxPart()
|
|
23
|
+
}()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridChartWebviewSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridChartWebviewSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::chartwebview {
|
|
11
|
+
} // namespace margelo::nitro::chartwebview
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridChartWebviewSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridChartWebviewSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridChartWebviewSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace ChartWebview { class HybridChartWebviewSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
#include <string>
|
|
18
|
+
#include <optional>
|
|
19
|
+
#include <functional>
|
|
20
|
+
|
|
21
|
+
#include "ChartWebview-Swift-Cxx-Umbrella.hpp"
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::chartwebview {
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The C++ part of HybridChartWebviewSpec_cxx.swift.
|
|
27
|
+
*
|
|
28
|
+
* HybridChartWebviewSpecSwift (C++) accesses HybridChartWebviewSpec_cxx (Swift), and might
|
|
29
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
30
|
+
*
|
|
31
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
32
|
+
* the future, HybridChartWebviewSpec_cxx can directly inherit from the C++ class HybridChartWebviewSpec
|
|
33
|
+
* to simplify the whole structure and memory management.
|
|
34
|
+
*/
|
|
35
|
+
class HybridChartWebviewSpecSwift: public virtual HybridChartWebviewSpec {
|
|
36
|
+
public:
|
|
37
|
+
// Constructor from a Swift instance
|
|
38
|
+
explicit HybridChartWebviewSpecSwift(const ChartWebview::HybridChartWebviewSpec_cxx& swiftPart):
|
|
39
|
+
HybridObject(HybridChartWebviewSpec::TAG),
|
|
40
|
+
_swiftPart(swiftPart) { }
|
|
41
|
+
|
|
42
|
+
public:
|
|
43
|
+
// Get the Swift part
|
|
44
|
+
inline ChartWebview::HybridChartWebviewSpec_cxx& getSwiftPart() noexcept {
|
|
45
|
+
return _swiftPart;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
50
|
+
return _swiftPart.getMemorySize();
|
|
51
|
+
}
|
|
52
|
+
void dispose() noexcept override {
|
|
53
|
+
_swiftPart.dispose();
|
|
54
|
+
}
|
|
55
|
+
std::string toString() override {
|
|
56
|
+
return _swiftPart.toString();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
// Properties
|
|
61
|
+
inline std::optional<std::string> getUri() noexcept override {
|
|
62
|
+
auto __result = _swiftPart.getUri();
|
|
63
|
+
return __result;
|
|
64
|
+
}
|
|
65
|
+
inline void setUri(const std::optional<std::string>& uri) noexcept override {
|
|
66
|
+
_swiftPart.setUri(uri);
|
|
67
|
+
}
|
|
68
|
+
inline std::optional<std::string> getLocalBundle() noexcept override {
|
|
69
|
+
auto __result = _swiftPart.getLocalBundle();
|
|
70
|
+
return __result;
|
|
71
|
+
}
|
|
72
|
+
inline void setLocalBundle(const std::optional<std::string>& localBundle) noexcept override {
|
|
73
|
+
_swiftPart.setLocalBundle(localBundle);
|
|
74
|
+
}
|
|
75
|
+
inline std::optional<std::string> getEntry() noexcept override {
|
|
76
|
+
auto __result = _swiftPart.getEntry();
|
|
77
|
+
return __result;
|
|
78
|
+
}
|
|
79
|
+
inline void setEntry(const std::optional<std::string>& entry) noexcept override {
|
|
80
|
+
_swiftPart.setEntry(entry);
|
|
81
|
+
}
|
|
82
|
+
inline std::optional<std::string> getParamsJson() noexcept override {
|
|
83
|
+
auto __result = _swiftPart.getParamsJson();
|
|
84
|
+
return __result;
|
|
85
|
+
}
|
|
86
|
+
inline void setParamsJson(const std::optional<std::string>& paramsJson) noexcept override {
|
|
87
|
+
_swiftPart.setParamsJson(paramsJson);
|
|
88
|
+
}
|
|
89
|
+
inline std::optional<std::string> getBridgeScript() noexcept override {
|
|
90
|
+
auto __result = _swiftPart.getBridgeScript();
|
|
91
|
+
return __result;
|
|
92
|
+
}
|
|
93
|
+
inline void setBridgeScript(const std::optional<std::string>& bridgeScript) noexcept override {
|
|
94
|
+
_swiftPart.setBridgeScript(bridgeScript);
|
|
95
|
+
}
|
|
96
|
+
inline std::optional<std::string> getReuseKey() noexcept override {
|
|
97
|
+
auto __result = _swiftPart.getReuseKey();
|
|
98
|
+
return __result;
|
|
99
|
+
}
|
|
100
|
+
inline void setReuseKey(const std::optional<std::string>& reuseKey) noexcept override {
|
|
101
|
+
_swiftPart.setReuseKey(reuseKey);
|
|
102
|
+
}
|
|
103
|
+
inline std::optional<bool> getPooled() noexcept override {
|
|
104
|
+
auto __result = _swiftPart.getPooled();
|
|
105
|
+
return __result;
|
|
106
|
+
}
|
|
107
|
+
inline void setPooled(std::optional<bool> pooled) noexcept override {
|
|
108
|
+
_swiftPart.setPooled(pooled);
|
|
109
|
+
}
|
|
110
|
+
inline std::optional<bool> getActive() noexcept override {
|
|
111
|
+
auto __result = _swiftPart.getActive();
|
|
112
|
+
return __result;
|
|
113
|
+
}
|
|
114
|
+
inline void setActive(std::optional<bool> active) noexcept override {
|
|
115
|
+
_swiftPart.setActive(active);
|
|
116
|
+
}
|
|
117
|
+
inline std::optional<std::function<void(const std::string& /* message */)>> getOnMessage() noexcept override {
|
|
118
|
+
auto __result = _swiftPart.getOnMessage();
|
|
119
|
+
return __result;
|
|
120
|
+
}
|
|
121
|
+
inline void setOnMessage(const std::optional<std::function<void(const std::string& /* message */)>>& onMessage) noexcept override {
|
|
122
|
+
_swiftPart.setOnMessage(onMessage);
|
|
123
|
+
}
|
|
124
|
+
inline std::optional<std::function<void()>> getOnLoadEnd() noexcept override {
|
|
125
|
+
auto __result = _swiftPart.getOnLoadEnd();
|
|
126
|
+
return __result;
|
|
127
|
+
}
|
|
128
|
+
inline void setOnLoadEnd(const std::optional<std::function<void()>>& onLoadEnd) noexcept override {
|
|
129
|
+
_swiftPart.setOnLoadEnd(onLoadEnd);
|
|
130
|
+
}
|
|
131
|
+
inline std::optional<std::function<void(const std::string& /* message */)>> getOnError() noexcept override {
|
|
132
|
+
auto __result = _swiftPart.getOnError();
|
|
133
|
+
return __result;
|
|
134
|
+
}
|
|
135
|
+
inline void setOnError(const std::optional<std::function<void(const std::string& /* message */)>>& onError) noexcept override {
|
|
136
|
+
_swiftPart.setOnError(onError);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
public:
|
|
140
|
+
// Methods
|
|
141
|
+
inline void postMessage(const std::string& message) override {
|
|
142
|
+
auto __result = _swiftPart.postMessage(message);
|
|
143
|
+
if (__result.hasError()) [[unlikely]] {
|
|
144
|
+
std::rethrow_exception(__result.error());
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
inline void reload() override {
|
|
148
|
+
auto __result = _swiftPart.reload();
|
|
149
|
+
if (__result.hasError()) [[unlikely]] {
|
|
150
|
+
std::rethrow_exception(__result.error());
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
inline void clearSnapshot() override {
|
|
154
|
+
auto __result = _swiftPart.clearSnapshot();
|
|
155
|
+
if (__result.hasError()) [[unlikely]] {
|
|
156
|
+
std::rethrow_exception(__result.error());
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
private:
|
|
161
|
+
ChartWebview::HybridChartWebviewSpec_cxx _swiftPart;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
} // namespace margelo::nitro::chartwebview
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridChartWebviewComponent.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import "HybridChartWebviewComponent.hpp"
|
|
9
|
+
#import <memory>
|
|
10
|
+
#import <react/renderer/componentregistry/ComponentDescriptorProvider.h>
|
|
11
|
+
#import <React/RCTViewComponentView.h>
|
|
12
|
+
#import <React/RCTComponentViewFactory.h>
|
|
13
|
+
#import <React/UIView+ComponentViewProtocol.h>
|
|
14
|
+
#import <NitroModules/NitroDefines.hpp>
|
|
15
|
+
#import <UIKit/UIKit.h>
|
|
16
|
+
|
|
17
|
+
#import "HybridChartWebviewSpecSwift.hpp"
|
|
18
|
+
#import "ChartWebview-Swift-Cxx-Umbrella.hpp"
|
|
19
|
+
|
|
20
|
+
using namespace facebook;
|
|
21
|
+
using namespace margelo::nitro::chartwebview;
|
|
22
|
+
using namespace margelo::nitro::chartwebview::views;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Represents the React Native View holder for the Nitro "ChartWebview" HybridView.
|
|
26
|
+
*/
|
|
27
|
+
@interface HybridChartWebviewComponent: RCTViewComponentView
|
|
28
|
+
@end
|
|
29
|
+
|
|
30
|
+
@implementation HybridChartWebviewComponent {
|
|
31
|
+
std::shared_ptr<HybridChartWebviewSpecSwift> _hybridView;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
+ (void) load {
|
|
35
|
+
[super load];
|
|
36
|
+
[RCTComponentViewFactory.currentComponentViewFactory registerComponentViewClass:[HybridChartWebviewComponent class]];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
+ (react::ComponentDescriptorProvider) componentDescriptorProvider {
|
|
40
|
+
return react::concreteComponentDescriptorProvider<HybridChartWebviewComponentDescriptor>();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
- (instancetype) init {
|
|
44
|
+
if (self = [super init]) {
|
|
45
|
+
std::shared_ptr<HybridChartWebviewSpec> hybridView = ChartWebview::ChartWebviewAutolinking::createChartWebview();
|
|
46
|
+
_hybridView = std::dynamic_pointer_cast<HybridChartWebviewSpecSwift>(hybridView);
|
|
47
|
+
[self updateView];
|
|
48
|
+
}
|
|
49
|
+
return self;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
- (void) updateView {
|
|
53
|
+
// 1. Get Swift part
|
|
54
|
+
ChartWebview::HybridChartWebviewSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
55
|
+
|
|
56
|
+
// 2. Get UIView*
|
|
57
|
+
void* viewUnsafe = swiftPart.getView();
|
|
58
|
+
UIView* view = (__bridge_transfer UIView*) viewUnsafe;
|
|
59
|
+
|
|
60
|
+
// 3. Update RCTViewComponentView's [contentView]
|
|
61
|
+
[self setContentView:view];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
- (void) updateProps:(const std::shared_ptr<const react::Props>&)props
|
|
65
|
+
oldProps:(const std::shared_ptr<const react::Props>&)oldProps {
|
|
66
|
+
// 1. Downcast props
|
|
67
|
+
const auto& newViewPropsConst = *std::static_pointer_cast<HybridChartWebviewProps const>(props);
|
|
68
|
+
auto& newViewProps = const_cast<HybridChartWebviewProps&>(newViewPropsConst);
|
|
69
|
+
ChartWebview::HybridChartWebviewSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
70
|
+
|
|
71
|
+
// 2. Update each prop individually
|
|
72
|
+
swiftPart.beforeUpdate();
|
|
73
|
+
|
|
74
|
+
// uri: optional
|
|
75
|
+
if (newViewProps.uri.isDirty) {
|
|
76
|
+
swiftPart.setUri(newViewProps.uri.value);
|
|
77
|
+
newViewProps.uri.isDirty = false;
|
|
78
|
+
}
|
|
79
|
+
// localBundle: optional
|
|
80
|
+
if (newViewProps.localBundle.isDirty) {
|
|
81
|
+
swiftPart.setLocalBundle(newViewProps.localBundle.value);
|
|
82
|
+
newViewProps.localBundle.isDirty = false;
|
|
83
|
+
}
|
|
84
|
+
// entry: optional
|
|
85
|
+
if (newViewProps.entry.isDirty) {
|
|
86
|
+
swiftPart.setEntry(newViewProps.entry.value);
|
|
87
|
+
newViewProps.entry.isDirty = false;
|
|
88
|
+
}
|
|
89
|
+
// paramsJson: optional
|
|
90
|
+
if (newViewProps.paramsJson.isDirty) {
|
|
91
|
+
swiftPart.setParamsJson(newViewProps.paramsJson.value);
|
|
92
|
+
newViewProps.paramsJson.isDirty = false;
|
|
93
|
+
}
|
|
94
|
+
// bridgeScript: optional
|
|
95
|
+
if (newViewProps.bridgeScript.isDirty) {
|
|
96
|
+
swiftPart.setBridgeScript(newViewProps.bridgeScript.value);
|
|
97
|
+
newViewProps.bridgeScript.isDirty = false;
|
|
98
|
+
}
|
|
99
|
+
// reuseKey: optional
|
|
100
|
+
if (newViewProps.reuseKey.isDirty) {
|
|
101
|
+
swiftPart.setReuseKey(newViewProps.reuseKey.value);
|
|
102
|
+
newViewProps.reuseKey.isDirty = false;
|
|
103
|
+
}
|
|
104
|
+
// pooled: optional
|
|
105
|
+
if (newViewProps.pooled.isDirty) {
|
|
106
|
+
swiftPart.setPooled(newViewProps.pooled.value);
|
|
107
|
+
newViewProps.pooled.isDirty = false;
|
|
108
|
+
}
|
|
109
|
+
// active: optional
|
|
110
|
+
if (newViewProps.active.isDirty) {
|
|
111
|
+
swiftPart.setActive(newViewProps.active.value);
|
|
112
|
+
newViewProps.active.isDirty = false;
|
|
113
|
+
}
|
|
114
|
+
// onMessage: optional
|
|
115
|
+
if (newViewProps.onMessage.isDirty) {
|
|
116
|
+
swiftPart.setOnMessage(newViewProps.onMessage.value);
|
|
117
|
+
newViewProps.onMessage.isDirty = false;
|
|
118
|
+
}
|
|
119
|
+
// onLoadEnd: optional
|
|
120
|
+
if (newViewProps.onLoadEnd.isDirty) {
|
|
121
|
+
swiftPart.setOnLoadEnd(newViewProps.onLoadEnd.value);
|
|
122
|
+
newViewProps.onLoadEnd.isDirty = false;
|
|
123
|
+
}
|
|
124
|
+
// onError: optional
|
|
125
|
+
if (newViewProps.onError.isDirty) {
|
|
126
|
+
swiftPart.setOnError(newViewProps.onError.value);
|
|
127
|
+
newViewProps.onError.isDirty = false;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
swiftPart.afterUpdate();
|
|
131
|
+
|
|
132
|
+
// 3. Update hybridRef if it changed
|
|
133
|
+
if (newViewProps.hybridRef.isDirty) {
|
|
134
|
+
// hybridRef changed - call it with new this
|
|
135
|
+
const auto& maybeFunc = newViewProps.hybridRef.value;
|
|
136
|
+
if (maybeFunc.has_value()) {
|
|
137
|
+
maybeFunc.value()(_hybridView);
|
|
138
|
+
}
|
|
139
|
+
newViewProps.hybridRef.isDirty = false;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// 4. Continue in base class
|
|
143
|
+
[super updateProps:props oldProps:oldProps];
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `() -> 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 {
|
|
16
|
+
public typealias bridge = margelo.nitro.chartwebview.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: () -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping () -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call() -> Void {
|
|
26
|
+
self.closure()
|
|
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`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void {
|
|
45
|
+
return Unmanaged<Func_void>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wraps a Swift `(_ message: String) -> 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_std__string {
|
|
16
|
+
public typealias bridge = margelo.nitro.chartwebview.bridge.swift
|
|
17
|
+
|
|
18
|
+
private let closure: (_ message: String) -> Void
|
|
19
|
+
|
|
20
|
+
public init(_ closure: @escaping (_ message: String) -> Void) {
|
|
21
|
+
self.closure = closure
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@inline(__always)
|
|
25
|
+
public func call(message: std.string) -> Void {
|
|
26
|
+
self.closure(String(message))
|
|
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_std__string`.
|
|
40
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__string>`.
|
|
41
|
+
* This removes one strong reference from the object!
|
|
42
|
+
*/
|
|
43
|
+
@inline(__always)
|
|
44
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__string {
|
|
45
|
+
return Unmanaged<Func_void_std__string>.fromOpaque(pointer).takeRetainedValue()
|
|
46
|
+
}
|
|
47
|
+
}
|