@rive-app/react-native 0.1.1 → 0.1.2
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/README.md +18 -7
- package/android/src/main/java/com/margelo/nitro/rive/HybridRiveFile.kt +0 -1
- package/android/src/main/java/com/margelo/nitro/rive/HybridViewModelInstance.kt +26 -47
- package/android/src/main/java/com/margelo/nitro/rive/HybridViewModelListProperty.kt +64 -0
- package/ios/BaseHybridViewModelProperty.swift +9 -0
- package/ios/HybridViewModelInstance.swift +5 -0
- package/ios/HybridViewModelListProperty.swift +62 -0
- package/lib/module/hooks/useRiveColor.js +0 -1
- package/lib/module/hooks/useRiveColor.js.map +1 -1
- package/lib/module/hooks/useRiveList.js +71 -0
- package/lib/module/hooks/useRiveList.js.map +1 -0
- package/lib/module/hooks/useRiveProperty.js +6 -12
- package/lib/module/hooks/useRiveProperty.js.map +1 -1
- package/lib/module/hooks/useViewModelInstance.js +139 -0
- package/lib/module/hooks/useViewModelInstance.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/hooks/useRiveColor.d.ts +6 -4
- package/lib/typescript/src/hooks/useRiveColor.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRiveList.d.ts +11 -0
- package/lib/typescript/src/hooks/useRiveList.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useRiveProperty.d.ts +6 -1
- package/lib/typescript/src/hooks/useRiveProperty.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useViewModelInstance.d.ts +86 -0
- package/lib/typescript/src/hooks/useViewModelInstance.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/ViewModel.nitro.d.ts +24 -0
- package/lib/typescript/src/specs/ViewModel.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +47 -3
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridViewModelInstanceSpec.cpp +9 -0
- package/nitrogen/generated/android/c++/JHybridViewModelInstanceSpec.hpp +1 -0
- package/nitrogen/generated/android/c++/JHybridViewModelListPropertySpec.cpp +102 -0
- package/nitrogen/generated/android/c++/JHybridViewModelListPropertySpec.hpp +73 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridViewModelInstanceSpec.kt +4 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridViewModelListPropertySpec.kt +92 -0
- package/nitrogen/generated/android/rive+autolinking.cmake +2 -0
- package/nitrogen/generated/android/riveOnLoad.cpp +2 -0
- package/nitrogen/generated/ios/RNRive-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/RNRive-Swift-Cxx-Bridge.hpp +44 -0
- package/nitrogen/generated/ios/RNRive-Swift-Cxx-Umbrella.hpp +5 -0
- package/nitrogen/generated/ios/c++/HybridViewModelInstanceSpecSwift.hpp +11 -0
- package/nitrogen/generated/ios/c++/HybridViewModelListPropertySpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridViewModelListPropertySpecSwift.hpp +134 -0
- package/nitrogen/generated/ios/swift/HybridViewModelInstanceSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridViewModelInstanceSpec_cxx.swift +21 -0
- package/nitrogen/generated/ios/swift/HybridViewModelListPropertySpec.swift +63 -0
- package/nitrogen/generated/ios/swift/HybridViewModelListPropertySpec_cxx.swift +248 -0
- package/nitrogen/generated/shared/c++/HybridViewModelInstanceSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridViewModelInstanceSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/HybridViewModelListPropertySpec.cpp +30 -0
- package/nitrogen/generated/shared/c++/HybridViewModelListPropertySpec.hpp +76 -0
- package/package.json +3 -3
- package/src/hooks/useRiveColor.ts +7 -4
- package/src/hooks/useRiveList.ts +108 -0
- package/src/hooks/useRiveProperty.ts +19 -12
- package/src/hooks/useViewModelInstance.ts +195 -0
- package/src/index.tsx +4 -0
- package/src/specs/ViewModel.nitro.ts +28 -0
- package/src/types.tsx +58 -3
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
#include "JHybridViewModelEnumPropertySpec.hpp"
|
|
39
39
|
#include "JHybridViewModelTriggerPropertySpec.hpp"
|
|
40
40
|
#include "JHybridViewModelImagePropertySpec.hpp"
|
|
41
|
+
#include "JHybridViewModelListPropertySpec.hpp"
|
|
41
42
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
42
43
|
|
|
43
44
|
namespace margelo::nitro::rive {
|
|
@@ -72,6 +73,7 @@ int initialize(JavaVM* vm) {
|
|
|
72
73
|
margelo::nitro::rive::JHybridViewModelEnumPropertySpec::registerNatives();
|
|
73
74
|
margelo::nitro::rive::JHybridViewModelTriggerPropertySpec::registerNatives();
|
|
74
75
|
margelo::nitro::rive::JHybridViewModelImagePropertySpec::registerNatives();
|
|
76
|
+
margelo::nitro::rive::JHybridViewModelListPropertySpec::registerNatives();
|
|
75
77
|
|
|
76
78
|
// Register Nitro Hybrid Objects
|
|
77
79
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
#include "HybridViewModelEnumPropertySpecSwift.hpp"
|
|
20
20
|
#include "HybridViewModelImagePropertySpecSwift.hpp"
|
|
21
21
|
#include "HybridViewModelInstanceSpecSwift.hpp"
|
|
22
|
+
#include "HybridViewModelListPropertySpecSwift.hpp"
|
|
22
23
|
#include "HybridViewModelNumberPropertySpecSwift.hpp"
|
|
23
24
|
#include "HybridViewModelPropertySpecSwift.hpp"
|
|
24
25
|
#include "HybridViewModelSpecSwift.hpp"
|
|
@@ -341,6 +342,22 @@ namespace margelo::nitro::rive::bridge::swift {
|
|
|
341
342
|
return swiftPart.toUnsafe();
|
|
342
343
|
}
|
|
343
344
|
|
|
345
|
+
// pragma MARK: std::shared_ptr<HybridViewModelListPropertySpec>
|
|
346
|
+
std::shared_ptr<HybridViewModelListPropertySpec> create_std__shared_ptr_HybridViewModelListPropertySpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
347
|
+
RNRive::HybridViewModelListPropertySpec_cxx swiftPart = RNRive::HybridViewModelListPropertySpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
348
|
+
return std::make_shared<margelo::nitro::rive::HybridViewModelListPropertySpecSwift>(swiftPart);
|
|
349
|
+
}
|
|
350
|
+
void* NON_NULL get_std__shared_ptr_HybridViewModelListPropertySpec_(std__shared_ptr_HybridViewModelListPropertySpec_ cppType) {
|
|
351
|
+
std::shared_ptr<margelo::nitro::rive::HybridViewModelListPropertySpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::rive::HybridViewModelListPropertySpecSwift>(cppType);
|
|
352
|
+
#ifdef NITRO_DEBUG
|
|
353
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
354
|
+
throw std::runtime_error("Class \"HybridViewModelListPropertySpec\" is not implemented in Swift!");
|
|
355
|
+
}
|
|
356
|
+
#endif
|
|
357
|
+
RNRive::HybridViewModelListPropertySpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
358
|
+
return swiftPart.toUnsafe();
|
|
359
|
+
}
|
|
360
|
+
|
|
344
361
|
// pragma MARK: std::function<void(double /* value */)>
|
|
345
362
|
Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
346
363
|
auto swiftClosure = RNRive::Func_void_double::fromUnsafe(swiftClosureWrapper);
|
|
@@ -42,6 +42,8 @@ namespace margelo::nitro::rive { class HybridViewModelEnumPropertySpec; }
|
|
|
42
42
|
namespace margelo::nitro::rive { class HybridViewModelImagePropertySpec; }
|
|
43
43
|
// Forward declaration of `HybridViewModelInstanceSpec` to properly resolve imports.
|
|
44
44
|
namespace margelo::nitro::rive { class HybridViewModelInstanceSpec; }
|
|
45
|
+
// Forward declaration of `HybridViewModelListPropertySpec` to properly resolve imports.
|
|
46
|
+
namespace margelo::nitro::rive { class HybridViewModelListPropertySpec; }
|
|
45
47
|
// Forward declaration of `HybridViewModelNumberPropertySpec` to properly resolve imports.
|
|
46
48
|
namespace margelo::nitro::rive { class HybridViewModelNumberPropertySpec; }
|
|
47
49
|
// Forward declaration of `HybridViewModelPropertySpec` to properly resolve imports.
|
|
@@ -88,6 +90,8 @@ namespace RNRive { class HybridViewModelEnumPropertySpec_cxx; }
|
|
|
88
90
|
namespace RNRive { class HybridViewModelImagePropertySpec_cxx; }
|
|
89
91
|
// Forward declaration of `HybridViewModelInstanceSpec_cxx` to properly resolve imports.
|
|
90
92
|
namespace RNRive { class HybridViewModelInstanceSpec_cxx; }
|
|
93
|
+
// Forward declaration of `HybridViewModelListPropertySpec_cxx` to properly resolve imports.
|
|
94
|
+
namespace RNRive { class HybridViewModelListPropertySpec_cxx; }
|
|
91
95
|
// Forward declaration of `HybridViewModelNumberPropertySpec_cxx` to properly resolve imports.
|
|
92
96
|
namespace RNRive { class HybridViewModelNumberPropertySpec_cxx; }
|
|
93
97
|
// Forward declaration of `HybridViewModelPropertySpec_cxx` to properly resolve imports.
|
|
@@ -117,6 +121,7 @@ namespace RNRive { class HybridViewModelTriggerPropertySpec_cxx; }
|
|
|
117
121
|
#include "HybridViewModelEnumPropertySpec.hpp"
|
|
118
122
|
#include "HybridViewModelImagePropertySpec.hpp"
|
|
119
123
|
#include "HybridViewModelInstanceSpec.hpp"
|
|
124
|
+
#include "HybridViewModelListPropertySpec.hpp"
|
|
120
125
|
#include "HybridViewModelNumberPropertySpec.hpp"
|
|
121
126
|
#include "HybridViewModelPropertySpec.hpp"
|
|
122
127
|
#include "HybridViewModelSpec.hpp"
|
|
@@ -1070,6 +1075,36 @@ namespace margelo::nitro::rive::bridge::swift {
|
|
|
1070
1075
|
return *optional;
|
|
1071
1076
|
}
|
|
1072
1077
|
|
|
1078
|
+
// pragma MARK: std::shared_ptr<HybridViewModelListPropertySpec>
|
|
1079
|
+
/**
|
|
1080
|
+
* Specialized version of `std::shared_ptr<HybridViewModelListPropertySpec>`.
|
|
1081
|
+
*/
|
|
1082
|
+
using std__shared_ptr_HybridViewModelListPropertySpec_ = std::shared_ptr<HybridViewModelListPropertySpec>;
|
|
1083
|
+
std::shared_ptr<HybridViewModelListPropertySpec> create_std__shared_ptr_HybridViewModelListPropertySpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
1084
|
+
void* NON_NULL get_std__shared_ptr_HybridViewModelListPropertySpec_(std__shared_ptr_HybridViewModelListPropertySpec_ cppType);
|
|
1085
|
+
|
|
1086
|
+
// pragma MARK: std::shared_ptr<HybridViewModelPropertySpec>
|
|
1087
|
+
inline std::shared_ptr<HybridViewModelPropertySpec> upcast_ViewModelListProperty_to_ViewModelProperty(std::shared_ptr<HybridViewModelListPropertySpec> child) noexcept { return child; }
|
|
1088
|
+
|
|
1089
|
+
// pragma MARK: std::weak_ptr<HybridViewModelListPropertySpec>
|
|
1090
|
+
using std__weak_ptr_HybridViewModelListPropertySpec_ = std::weak_ptr<HybridViewModelListPropertySpec>;
|
|
1091
|
+
inline std__weak_ptr_HybridViewModelListPropertySpec_ weakify_std__shared_ptr_HybridViewModelListPropertySpec_(const std::shared_ptr<HybridViewModelListPropertySpec>& strong) noexcept { return strong; }
|
|
1092
|
+
|
|
1093
|
+
// pragma MARK: std::optional<std::shared_ptr<HybridViewModelListPropertySpec>>
|
|
1094
|
+
/**
|
|
1095
|
+
* Specialized version of `std::optional<std::shared_ptr<HybridViewModelListPropertySpec>>`.
|
|
1096
|
+
*/
|
|
1097
|
+
using std__optional_std__shared_ptr_HybridViewModelListPropertySpec__ = std::optional<std::shared_ptr<HybridViewModelListPropertySpec>>;
|
|
1098
|
+
inline std::optional<std::shared_ptr<HybridViewModelListPropertySpec>> create_std__optional_std__shared_ptr_HybridViewModelListPropertySpec__(const std::shared_ptr<HybridViewModelListPropertySpec>& value) noexcept {
|
|
1099
|
+
return std::optional<std::shared_ptr<HybridViewModelListPropertySpec>>(value);
|
|
1100
|
+
}
|
|
1101
|
+
inline bool has_value_std__optional_std__shared_ptr_HybridViewModelListPropertySpec__(const std::optional<std::shared_ptr<HybridViewModelListPropertySpec>>& optional) noexcept {
|
|
1102
|
+
return optional.has_value();
|
|
1103
|
+
}
|
|
1104
|
+
inline std::shared_ptr<HybridViewModelListPropertySpec> get_std__optional_std__shared_ptr_HybridViewModelListPropertySpec__(const std::optional<std::shared_ptr<HybridViewModelListPropertySpec>>& optional) noexcept {
|
|
1105
|
+
return *optional;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1073
1108
|
// pragma MARK: Result<std::optional<std::shared_ptr<HybridViewModelNumberPropertySpec>>>
|
|
1074
1109
|
using Result_std__optional_std__shared_ptr_HybridViewModelNumberPropertySpec___ = Result<std::optional<std::shared_ptr<HybridViewModelNumberPropertySpec>>>;
|
|
1075
1110
|
inline Result_std__optional_std__shared_ptr_HybridViewModelNumberPropertySpec___ create_Result_std__optional_std__shared_ptr_HybridViewModelNumberPropertySpec___(const std::optional<std::shared_ptr<HybridViewModelNumberPropertySpec>>& value) noexcept {
|
|
@@ -1133,6 +1168,15 @@ namespace margelo::nitro::rive::bridge::swift {
|
|
|
1133
1168
|
return Result<std::optional<std::shared_ptr<HybridViewModelImagePropertySpec>>>::withError(error);
|
|
1134
1169
|
}
|
|
1135
1170
|
|
|
1171
|
+
// pragma MARK: Result<std::optional<std::shared_ptr<HybridViewModelListPropertySpec>>>
|
|
1172
|
+
using Result_std__optional_std__shared_ptr_HybridViewModelListPropertySpec___ = Result<std::optional<std::shared_ptr<HybridViewModelListPropertySpec>>>;
|
|
1173
|
+
inline Result_std__optional_std__shared_ptr_HybridViewModelListPropertySpec___ create_Result_std__optional_std__shared_ptr_HybridViewModelListPropertySpec___(const std::optional<std::shared_ptr<HybridViewModelListPropertySpec>>& value) noexcept {
|
|
1174
|
+
return Result<std::optional<std::shared_ptr<HybridViewModelListPropertySpec>>>::withValue(value);
|
|
1175
|
+
}
|
|
1176
|
+
inline Result_std__optional_std__shared_ptr_HybridViewModelListPropertySpec___ create_Result_std__optional_std__shared_ptr_HybridViewModelListPropertySpec___(const std::exception_ptr& error) noexcept {
|
|
1177
|
+
return Result<std::optional<std::shared_ptr<HybridViewModelListPropertySpec>>>::withError(error);
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1136
1180
|
// pragma MARK: std::function<void(double /* value */)>
|
|
1137
1181
|
/**
|
|
1138
1182
|
* Specialized version of `std::function<void(double)>`.
|
|
@@ -42,6 +42,8 @@ namespace margelo::nitro::rive { class HybridViewModelEnumPropertySpec; }
|
|
|
42
42
|
namespace margelo::nitro::rive { class HybridViewModelImagePropertySpec; }
|
|
43
43
|
// Forward declaration of `HybridViewModelInstanceSpec` to properly resolve imports.
|
|
44
44
|
namespace margelo::nitro::rive { class HybridViewModelInstanceSpec; }
|
|
45
|
+
// Forward declaration of `HybridViewModelListPropertySpec` to properly resolve imports.
|
|
46
|
+
namespace margelo::nitro::rive { class HybridViewModelListPropertySpec; }
|
|
45
47
|
// Forward declaration of `HybridViewModelNumberPropertySpec` to properly resolve imports.
|
|
46
48
|
namespace margelo::nitro::rive { class HybridViewModelNumberPropertySpec; }
|
|
47
49
|
// Forward declaration of `HybridViewModelPropertySpec` to properly resolve imports.
|
|
@@ -83,6 +85,7 @@ namespace margelo::nitro::rive { struct UnifiedRiveEvent; }
|
|
|
83
85
|
#include "HybridViewModelEnumPropertySpec.hpp"
|
|
84
86
|
#include "HybridViewModelImagePropertySpec.hpp"
|
|
85
87
|
#include "HybridViewModelInstanceSpec.hpp"
|
|
88
|
+
#include "HybridViewModelListPropertySpec.hpp"
|
|
86
89
|
#include "HybridViewModelNumberPropertySpec.hpp"
|
|
87
90
|
#include "HybridViewModelPropertySpec.hpp"
|
|
88
91
|
#include "HybridViewModelSpec.hpp"
|
|
@@ -137,6 +140,8 @@ namespace RNRive { class HybridViewModelEnumPropertySpec_cxx; }
|
|
|
137
140
|
namespace RNRive { class HybridViewModelImagePropertySpec_cxx; }
|
|
138
141
|
// Forward declaration of `HybridViewModelInstanceSpec_cxx` to properly resolve imports.
|
|
139
142
|
namespace RNRive { class HybridViewModelInstanceSpec_cxx; }
|
|
143
|
+
// Forward declaration of `HybridViewModelListPropertySpec_cxx` to properly resolve imports.
|
|
144
|
+
namespace RNRive { class HybridViewModelListPropertySpec_cxx; }
|
|
140
145
|
// Forward declaration of `HybridViewModelNumberPropertySpec_cxx` to properly resolve imports.
|
|
141
146
|
namespace RNRive { class HybridViewModelNumberPropertySpec_cxx; }
|
|
142
147
|
// Forward declaration of `HybridViewModelPropertySpec_cxx` to properly resolve imports.
|
|
@@ -26,6 +26,8 @@ namespace margelo::nitro::rive { class HybridViewModelEnumPropertySpec; }
|
|
|
26
26
|
namespace margelo::nitro::rive { class HybridViewModelTriggerPropertySpec; }
|
|
27
27
|
// Forward declaration of `HybridViewModelImagePropertySpec` to properly resolve imports.
|
|
28
28
|
namespace margelo::nitro::rive { class HybridViewModelImagePropertySpec; }
|
|
29
|
+
// Forward declaration of `HybridViewModelListPropertySpec` to properly resolve imports.
|
|
30
|
+
namespace margelo::nitro::rive { class HybridViewModelListPropertySpec; }
|
|
29
31
|
|
|
30
32
|
#include <string>
|
|
31
33
|
#include <memory>
|
|
@@ -37,6 +39,7 @@ namespace margelo::nitro::rive { class HybridViewModelImagePropertySpec; }
|
|
|
37
39
|
#include "HybridViewModelEnumPropertySpec.hpp"
|
|
38
40
|
#include "HybridViewModelTriggerPropertySpec.hpp"
|
|
39
41
|
#include "HybridViewModelImagePropertySpec.hpp"
|
|
42
|
+
#include "HybridViewModelListPropertySpec.hpp"
|
|
40
43
|
|
|
41
44
|
#include "RNRive-Swift-Cxx-Umbrella.hpp"
|
|
42
45
|
|
|
@@ -141,6 +144,14 @@ namespace margelo::nitro::rive {
|
|
|
141
144
|
auto __value = std::move(__result.value());
|
|
142
145
|
return __value;
|
|
143
146
|
}
|
|
147
|
+
inline std::optional<std::shared_ptr<HybridViewModelListPropertySpec>> listProperty(const std::string& path) override {
|
|
148
|
+
auto __result = _swiftPart.listProperty(path);
|
|
149
|
+
if (__result.hasError()) [[unlikely]] {
|
|
150
|
+
std::rethrow_exception(__result.error());
|
|
151
|
+
}
|
|
152
|
+
auto __value = std::move(__result.value());
|
|
153
|
+
return __value;
|
|
154
|
+
}
|
|
144
155
|
|
|
145
156
|
private:
|
|
146
157
|
RNRive::HybridViewModelInstanceSpec_cxx _swiftPart;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridViewModelListPropertySpecSwift.cpp
|
|
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
|
+
#include "HybridViewModelListPropertySpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::rive {
|
|
11
|
+
} // namespace margelo::nitro::rive
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridViewModelListPropertySpecSwift.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridViewModelListPropertySpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridViewModelListPropertySpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace RNRive { class HybridViewModelListPropertySpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `HybridViewModelInstanceSpec` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::rive { class HybridViewModelInstanceSpec; }
|
|
17
|
+
// Forward declaration of `HybridViewModelPropertySpecSwift` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::rive { class HybridViewModelPropertySpecSwift; }
|
|
19
|
+
|
|
20
|
+
#include <memory>
|
|
21
|
+
#include "HybridViewModelInstanceSpec.hpp"
|
|
22
|
+
#include <optional>
|
|
23
|
+
#include <functional>
|
|
24
|
+
#include "HybridViewModelPropertySpecSwift.hpp"
|
|
25
|
+
|
|
26
|
+
#include "RNRive-Swift-Cxx-Umbrella.hpp"
|
|
27
|
+
|
|
28
|
+
namespace margelo::nitro::rive {
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The C++ part of HybridViewModelListPropertySpec_cxx.swift.
|
|
32
|
+
*
|
|
33
|
+
* HybridViewModelListPropertySpecSwift (C++) accesses HybridViewModelListPropertySpec_cxx (Swift), and might
|
|
34
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
35
|
+
*
|
|
36
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
37
|
+
* the future, HybridViewModelListPropertySpec_cxx can directly inherit from the C++ class HybridViewModelListPropertySpec
|
|
38
|
+
* to simplify the whole structure and memory management.
|
|
39
|
+
*/
|
|
40
|
+
class HybridViewModelListPropertySpecSwift: public virtual HybridViewModelListPropertySpec, public virtual HybridViewModelPropertySpecSwift {
|
|
41
|
+
public:
|
|
42
|
+
// Constructor from a Swift instance
|
|
43
|
+
explicit HybridViewModelListPropertySpecSwift(const RNRive::HybridViewModelListPropertySpec_cxx& swiftPart):
|
|
44
|
+
HybridObject(HybridViewModelListPropertySpec::TAG),
|
|
45
|
+
HybridViewModelPropertySpecSwift(swiftPart),
|
|
46
|
+
_swiftPart(swiftPart) { }
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
// Get the Swift part
|
|
50
|
+
inline RNRive::HybridViewModelListPropertySpec_cxx& getSwiftPart() noexcept {
|
|
51
|
+
return _swiftPart;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
56
|
+
return _swiftPart.getMemorySize();
|
|
57
|
+
}
|
|
58
|
+
void dispose() noexcept override {
|
|
59
|
+
_swiftPart.dispose();
|
|
60
|
+
}
|
|
61
|
+
std::string toString() override {
|
|
62
|
+
return _swiftPart.toString();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public:
|
|
66
|
+
// Properties
|
|
67
|
+
inline double getLength() noexcept override {
|
|
68
|
+
return _swiftPart.getLength();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public:
|
|
72
|
+
// Methods
|
|
73
|
+
inline std::optional<std::shared_ptr<HybridViewModelInstanceSpec>> getInstanceAt(double index) override {
|
|
74
|
+
auto __result = _swiftPart.getInstanceAt(std::forward<decltype(index)>(index));
|
|
75
|
+
if (__result.hasError()) [[unlikely]] {
|
|
76
|
+
std::rethrow_exception(__result.error());
|
|
77
|
+
}
|
|
78
|
+
auto __value = std::move(__result.value());
|
|
79
|
+
return __value;
|
|
80
|
+
}
|
|
81
|
+
inline void addInstance(const std::shared_ptr<HybridViewModelInstanceSpec>& instance) override {
|
|
82
|
+
auto __result = _swiftPart.addInstance(instance);
|
|
83
|
+
if (__result.hasError()) [[unlikely]] {
|
|
84
|
+
std::rethrow_exception(__result.error());
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
inline bool addInstanceAt(const std::shared_ptr<HybridViewModelInstanceSpec>& instance, double index) override {
|
|
88
|
+
auto __result = _swiftPart.addInstanceAt(instance, std::forward<decltype(index)>(index));
|
|
89
|
+
if (__result.hasError()) [[unlikely]] {
|
|
90
|
+
std::rethrow_exception(__result.error());
|
|
91
|
+
}
|
|
92
|
+
auto __value = std::move(__result.value());
|
|
93
|
+
return __value;
|
|
94
|
+
}
|
|
95
|
+
inline void removeInstance(const std::shared_ptr<HybridViewModelInstanceSpec>& instance) override {
|
|
96
|
+
auto __result = _swiftPart.removeInstance(instance);
|
|
97
|
+
if (__result.hasError()) [[unlikely]] {
|
|
98
|
+
std::rethrow_exception(__result.error());
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
inline void removeInstanceAt(double index) override {
|
|
102
|
+
auto __result = _swiftPart.removeInstanceAt(std::forward<decltype(index)>(index));
|
|
103
|
+
if (__result.hasError()) [[unlikely]] {
|
|
104
|
+
std::rethrow_exception(__result.error());
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
inline bool swap(double index1, double index2) override {
|
|
108
|
+
auto __result = _swiftPart.swap(std::forward<decltype(index1)>(index1), std::forward<decltype(index2)>(index2));
|
|
109
|
+
if (__result.hasError()) [[unlikely]] {
|
|
110
|
+
std::rethrow_exception(__result.error());
|
|
111
|
+
}
|
|
112
|
+
auto __value = std::move(__result.value());
|
|
113
|
+
return __value;
|
|
114
|
+
}
|
|
115
|
+
inline std::function<void()> addListener(const std::function<void()>& onChanged) override {
|
|
116
|
+
auto __result = _swiftPart.addListener(onChanged);
|
|
117
|
+
if (__result.hasError()) [[unlikely]] {
|
|
118
|
+
std::rethrow_exception(__result.error());
|
|
119
|
+
}
|
|
120
|
+
auto __value = std::move(__result.value());
|
|
121
|
+
return __value;
|
|
122
|
+
}
|
|
123
|
+
inline void removeListeners() override {
|
|
124
|
+
auto __result = _swiftPart.removeListeners();
|
|
125
|
+
if (__result.hasError()) [[unlikely]] {
|
|
126
|
+
std::rethrow_exception(__result.error());
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
private:
|
|
131
|
+
RNRive::HybridViewModelListPropertySpec_cxx _swiftPart;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
} // namespace margelo::nitro::rive
|
|
@@ -21,6 +21,7 @@ public protocol HybridViewModelInstanceSpec_protocol: HybridObject {
|
|
|
21
21
|
func enumProperty(path: String) throws -> (any HybridViewModelEnumPropertySpec)?
|
|
22
22
|
func triggerProperty(path: String) throws -> (any HybridViewModelTriggerPropertySpec)?
|
|
23
23
|
func imageProperty(path: String) throws -> (any HybridViewModelImagePropertySpec)?
|
|
24
|
+
func listProperty(path: String) throws -> (any HybridViewModelListPropertySpec)?
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
public extension HybridViewModelInstanceSpec_protocol {
|
|
@@ -268,4 +268,25 @@ open class HybridViewModelInstanceSpec_cxx {
|
|
|
268
268
|
return bridge.create_Result_std__optional_std__shared_ptr_HybridViewModelImagePropertySpec___(__exceptionPtr)
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
+
|
|
272
|
+
@inline(__always)
|
|
273
|
+
public final func listProperty(path: std.string) -> bridge.Result_std__optional_std__shared_ptr_HybridViewModelListPropertySpec___ {
|
|
274
|
+
do {
|
|
275
|
+
let __result = try self.__implementation.listProperty(path: String(path))
|
|
276
|
+
let __resultCpp = { () -> bridge.std__optional_std__shared_ptr_HybridViewModelListPropertySpec__ in
|
|
277
|
+
if let __unwrappedValue = __result {
|
|
278
|
+
return bridge.create_std__optional_std__shared_ptr_HybridViewModelListPropertySpec__({ () -> bridge.std__shared_ptr_HybridViewModelListPropertySpec_ in
|
|
279
|
+
let __cxxWrapped = __unwrappedValue.getCxxWrapper()
|
|
280
|
+
return __cxxWrapped.getCxxPart()
|
|
281
|
+
}())
|
|
282
|
+
} else {
|
|
283
|
+
return .init()
|
|
284
|
+
}
|
|
285
|
+
}()
|
|
286
|
+
return bridge.create_Result_std__optional_std__shared_ptr_HybridViewModelListPropertySpec___(__resultCpp)
|
|
287
|
+
} catch (let __error) {
|
|
288
|
+
let __exceptionPtr = __error.toCpp()
|
|
289
|
+
return bridge.create_Result_std__optional_std__shared_ptr_HybridViewModelListPropertySpec___(__exceptionPtr)
|
|
290
|
+
}
|
|
291
|
+
}
|
|
271
292
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridViewModelListPropertySpec.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 ``HybridViewModelListPropertySpec``
|
|
12
|
+
public protocol HybridViewModelListPropertySpec_protocol: HybridObject, HybridViewModelPropertySpec_protocol {
|
|
13
|
+
// Properties
|
|
14
|
+
var length: Double { get }
|
|
15
|
+
|
|
16
|
+
// Methods
|
|
17
|
+
func getInstanceAt(index: Double) throws -> (any HybridViewModelInstanceSpec)?
|
|
18
|
+
func addInstance(instance: (any HybridViewModelInstanceSpec)) throws -> Void
|
|
19
|
+
func addInstanceAt(instance: (any HybridViewModelInstanceSpec), index: Double) throws -> Bool
|
|
20
|
+
func removeInstance(instance: (any HybridViewModelInstanceSpec)) throws -> Void
|
|
21
|
+
func removeInstanceAt(index: Double) throws -> Void
|
|
22
|
+
func swap(index1: Double, index2: Double) throws -> Bool
|
|
23
|
+
func addListener(onChanged: @escaping () -> Void) throws -> () -> Void
|
|
24
|
+
func removeListeners() throws -> Void
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public extension HybridViewModelListPropertySpec_protocol {
|
|
28
|
+
/// Default implementation of ``HybridObject.toString``
|
|
29
|
+
func toString() -> String {
|
|
30
|
+
return "[HybridObject ViewModelListProperty]"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/// See ``HybridViewModelListPropertySpec``
|
|
35
|
+
open class HybridViewModelListPropertySpec_base: HybridViewModelPropertySpec_base {
|
|
36
|
+
private weak var cxxWrapper: HybridViewModelListPropertySpec_cxx? = nil
|
|
37
|
+
public override init() { super.init() }
|
|
38
|
+
public override func getCxxWrapper() -> HybridViewModelListPropertySpec_cxx {
|
|
39
|
+
#if DEBUG
|
|
40
|
+
guard self is HybridViewModelListPropertySpec else {
|
|
41
|
+
fatalError("`self` is not a `HybridViewModelListPropertySpec`! Did you accidentally inherit from `HybridViewModelListPropertySpec_base` instead of `HybridViewModelListPropertySpec`?")
|
|
42
|
+
}
|
|
43
|
+
#endif
|
|
44
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
45
|
+
return cxxWrapper
|
|
46
|
+
} else {
|
|
47
|
+
let cxxWrapper = HybridViewModelListPropertySpec_cxx(self as! HybridViewModelListPropertySpec)
|
|
48
|
+
self.cxxWrapper = cxxWrapper
|
|
49
|
+
return cxxWrapper
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A Swift base-protocol representing the ViewModelListProperty HybridObject.
|
|
56
|
+
* Implement this protocol to create Swift-based instances of ViewModelListProperty.
|
|
57
|
+
* ```swift
|
|
58
|
+
* class HybridViewModelListProperty : HybridViewModelListPropertySpec {
|
|
59
|
+
* // ...
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
public typealias HybridViewModelListPropertySpec = HybridViewModelListPropertySpec_protocol & HybridViewModelListPropertySpec_base
|