@rive-app/react-native 0.1.1-beta.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.
Files changed (130) hide show
  1. package/README.md +18 -7
  2. package/android/src/main/java/com/margelo/nitro/rive/BaseHybridViewModelProperty.kt +9 -7
  3. package/android/src/main/java/com/margelo/nitro/rive/BaseHybridViewModelPropertyImpl.kt +43 -24
  4. package/android/src/main/java/com/margelo/nitro/rive/HybridRiveFile.kt +0 -1
  5. package/android/src/main/java/com/margelo/nitro/rive/HybridViewModelBooleanProperty.kt +3 -2
  6. package/android/src/main/java/com/margelo/nitro/rive/HybridViewModelColorProperty.kt +3 -2
  7. package/android/src/main/java/com/margelo/nitro/rive/HybridViewModelEnumProperty.kt +3 -2
  8. package/android/src/main/java/com/margelo/nitro/rive/HybridViewModelImageProperty.kt +3 -2
  9. package/android/src/main/java/com/margelo/nitro/rive/HybridViewModelInstance.kt +26 -47
  10. package/android/src/main/java/com/margelo/nitro/rive/HybridViewModelListProperty.kt +64 -0
  11. package/android/src/main/java/com/margelo/nitro/rive/HybridViewModelNumberProperty.kt +3 -2
  12. package/android/src/main/java/com/margelo/nitro/rive/HybridViewModelStringProperty.kt +3 -2
  13. package/android/src/main/java/com/margelo/nitro/rive/HybridViewModelTriggerProperty.kt +3 -2
  14. package/ios/BaseHybridViewModelProperty.swift +22 -6
  15. package/ios/HybridViewModel.swift +1 -6
  16. package/ios/HybridViewModelBooleanProperty.swift +1 -9
  17. package/ios/HybridViewModelColorProperty.swift +3 -12
  18. package/ios/HybridViewModelEnumProperty.swift +1 -9
  19. package/ios/HybridViewModelImageProperty.swift +4 -4
  20. package/ios/HybridViewModelInstance.swift +6 -6
  21. package/ios/HybridViewModelListProperty.swift +62 -0
  22. package/ios/HybridViewModelNumberProperty.swift +2 -13
  23. package/ios/HybridViewModelStringProperty.swift +1 -9
  24. package/ios/HybridViewModelTriggerProperty.swift +5 -14
  25. package/ios/RiveReactNativeView.swift +36 -0
  26. package/lib/module/hooks/useRiveColor.js +0 -1
  27. package/lib/module/hooks/useRiveColor.js.map +1 -1
  28. package/lib/module/hooks/useRiveList.js +71 -0
  29. package/lib/module/hooks/useRiveList.js.map +1 -0
  30. package/lib/module/hooks/useRiveProperty.js +6 -12
  31. package/lib/module/hooks/useRiveProperty.js.map +1 -1
  32. package/lib/module/hooks/useViewModelInstance.js +139 -0
  33. package/lib/module/hooks/useViewModelInstance.js.map +1 -0
  34. package/lib/module/index.js +2 -0
  35. package/lib/module/index.js.map +1 -1
  36. package/lib/typescript/src/hooks/useRiveColor.d.ts +6 -4
  37. package/lib/typescript/src/hooks/useRiveColor.d.ts.map +1 -1
  38. package/lib/typescript/src/hooks/useRiveList.d.ts +11 -0
  39. package/lib/typescript/src/hooks/useRiveList.d.ts.map +1 -0
  40. package/lib/typescript/src/hooks/useRiveProperty.d.ts +6 -1
  41. package/lib/typescript/src/hooks/useRiveProperty.d.ts.map +1 -1
  42. package/lib/typescript/src/hooks/useViewModelInstance.d.ts +86 -0
  43. package/lib/typescript/src/hooks/useViewModelInstance.d.ts.map +1 -0
  44. package/lib/typescript/src/index.d.ts +4 -1
  45. package/lib/typescript/src/index.d.ts.map +1 -1
  46. package/lib/typescript/src/specs/ViewModel.nitro.d.ts +39 -15
  47. package/lib/typescript/src/specs/ViewModel.nitro.d.ts.map +1 -1
  48. package/lib/typescript/src/types.d.ts +47 -3
  49. package/lib/typescript/src/types.d.ts.map +1 -1
  50. package/nitrogen/generated/android/c++/JHybridViewModelBooleanPropertySpec.cpp +14 -4
  51. package/nitrogen/generated/android/c++/JHybridViewModelBooleanPropertySpec.hpp +1 -1
  52. package/nitrogen/generated/android/c++/JHybridViewModelColorPropertySpec.cpp +14 -4
  53. package/nitrogen/generated/android/c++/JHybridViewModelColorPropertySpec.hpp +1 -1
  54. package/nitrogen/generated/android/c++/JHybridViewModelEnumPropertySpec.cpp +14 -4
  55. package/nitrogen/generated/android/c++/JHybridViewModelEnumPropertySpec.hpp +1 -1
  56. package/nitrogen/generated/android/c++/JHybridViewModelImagePropertySpec.cpp +15 -6
  57. package/nitrogen/generated/android/c++/JHybridViewModelImagePropertySpec.hpp +1 -1
  58. package/nitrogen/generated/android/c++/JHybridViewModelInstanceSpec.cpp +9 -0
  59. package/nitrogen/generated/android/c++/JHybridViewModelInstanceSpec.hpp +1 -0
  60. package/nitrogen/generated/android/c++/JHybridViewModelListPropertySpec.cpp +102 -0
  61. package/nitrogen/generated/android/c++/JHybridViewModelListPropertySpec.hpp +73 -0
  62. package/nitrogen/generated/android/c++/JHybridViewModelNumberPropertySpec.cpp +14 -4
  63. package/nitrogen/generated/android/c++/JHybridViewModelNumberPropertySpec.hpp +1 -1
  64. package/nitrogen/generated/android/c++/JHybridViewModelStringPropertySpec.cpp +14 -4
  65. package/nitrogen/generated/android/c++/JHybridViewModelStringPropertySpec.hpp +1 -1
  66. package/nitrogen/generated/android/c++/JHybridViewModelTriggerPropertySpec.cpp +12 -3
  67. package/nitrogen/generated/android/c++/JHybridViewModelTriggerPropertySpec.hpp +1 -1
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridViewModelBooleanPropertySpec.kt +3 -3
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridViewModelColorPropertySpec.kt +3 -3
  70. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridViewModelEnumPropertySpec.kt +3 -3
  71. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridViewModelImagePropertySpec.kt +3 -3
  72. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridViewModelInstanceSpec.kt +4 -0
  73. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridViewModelListPropertySpec.kt +92 -0
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridViewModelNumberPropertySpec.kt +3 -3
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridViewModelStringPropertySpec.kt +3 -3
  76. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rive/HybridViewModelTriggerPropertySpec.kt +3 -3
  77. package/nitrogen/generated/android/rive+autolinking.cmake +2 -0
  78. package/nitrogen/generated/android/riveOnLoad.cpp +4 -74
  79. package/nitrogen/generated/ios/RNRive-Swift-Cxx-Bridge.cpp +17 -0
  80. package/nitrogen/generated/ios/RNRive-Swift-Cxx-Bridge.hpp +53 -0
  81. package/nitrogen/generated/ios/RNRive-Swift-Cxx-Umbrella.hpp +5 -0
  82. package/nitrogen/generated/ios/RNRiveAutolinking.mm +0 -72
  83. package/nitrogen/generated/ios/RNRiveAutolinking.swift +0 -135
  84. package/nitrogen/generated/ios/c++/HybridViewModelBooleanPropertySpecSwift.hpp +3 -1
  85. package/nitrogen/generated/ios/c++/HybridViewModelColorPropertySpecSwift.hpp +3 -1
  86. package/nitrogen/generated/ios/c++/HybridViewModelEnumPropertySpecSwift.hpp +3 -1
  87. package/nitrogen/generated/ios/c++/HybridViewModelImagePropertySpecSwift.hpp +3 -1
  88. package/nitrogen/generated/ios/c++/HybridViewModelInstanceSpecSwift.hpp +11 -0
  89. package/nitrogen/generated/ios/c++/HybridViewModelListPropertySpecSwift.cpp +11 -0
  90. package/nitrogen/generated/ios/c++/HybridViewModelListPropertySpecSwift.hpp +134 -0
  91. package/nitrogen/generated/ios/c++/HybridViewModelNumberPropertySpecSwift.hpp +3 -1
  92. package/nitrogen/generated/ios/c++/HybridViewModelStringPropertySpecSwift.hpp +3 -1
  93. package/nitrogen/generated/ios/c++/HybridViewModelTriggerPropertySpecSwift.hpp +3 -1
  94. package/nitrogen/generated/ios/swift/HybridViewModelBooleanPropertySpec.swift +1 -1
  95. package/nitrogen/generated/ios/swift/HybridViewModelBooleanPropertySpec_cxx.swift +8 -4
  96. package/nitrogen/generated/ios/swift/HybridViewModelColorPropertySpec.swift +1 -1
  97. package/nitrogen/generated/ios/swift/HybridViewModelColorPropertySpec_cxx.swift +8 -4
  98. package/nitrogen/generated/ios/swift/HybridViewModelEnumPropertySpec.swift +1 -1
  99. package/nitrogen/generated/ios/swift/HybridViewModelEnumPropertySpec_cxx.swift +8 -4
  100. package/nitrogen/generated/ios/swift/HybridViewModelImagePropertySpec.swift +1 -1
  101. package/nitrogen/generated/ios/swift/HybridViewModelImagePropertySpec_cxx.swift +8 -4
  102. package/nitrogen/generated/ios/swift/HybridViewModelInstanceSpec.swift +1 -0
  103. package/nitrogen/generated/ios/swift/HybridViewModelInstanceSpec_cxx.swift +21 -0
  104. package/nitrogen/generated/ios/swift/HybridViewModelListPropertySpec.swift +63 -0
  105. package/nitrogen/generated/ios/swift/HybridViewModelListPropertySpec_cxx.swift +248 -0
  106. package/nitrogen/generated/ios/swift/HybridViewModelNumberPropertySpec.swift +1 -1
  107. package/nitrogen/generated/ios/swift/HybridViewModelNumberPropertySpec_cxx.swift +8 -4
  108. package/nitrogen/generated/ios/swift/HybridViewModelStringPropertySpec.swift +1 -1
  109. package/nitrogen/generated/ios/swift/HybridViewModelStringPropertySpec_cxx.swift +8 -4
  110. package/nitrogen/generated/ios/swift/HybridViewModelTriggerPropertySpec.swift +1 -1
  111. package/nitrogen/generated/ios/swift/HybridViewModelTriggerPropertySpec_cxx.swift +8 -4
  112. package/nitrogen/generated/shared/c++/HybridViewModelBooleanPropertySpec.hpp +1 -1
  113. package/nitrogen/generated/shared/c++/HybridViewModelColorPropertySpec.hpp +1 -1
  114. package/nitrogen/generated/shared/c++/HybridViewModelEnumPropertySpec.hpp +1 -1
  115. package/nitrogen/generated/shared/c++/HybridViewModelImagePropertySpec.hpp +1 -1
  116. package/nitrogen/generated/shared/c++/HybridViewModelInstanceSpec.cpp +1 -0
  117. package/nitrogen/generated/shared/c++/HybridViewModelInstanceSpec.hpp +4 -0
  118. package/nitrogen/generated/shared/c++/HybridViewModelListPropertySpec.cpp +30 -0
  119. package/nitrogen/generated/shared/c++/HybridViewModelListPropertySpec.hpp +76 -0
  120. package/nitrogen/generated/shared/c++/HybridViewModelNumberPropertySpec.hpp +1 -1
  121. package/nitrogen/generated/shared/c++/HybridViewModelStringPropertySpec.hpp +1 -1
  122. package/nitrogen/generated/shared/c++/HybridViewModelTriggerPropertySpec.hpp +1 -1
  123. package/package.json +3 -3
  124. package/src/hooks/useRiveColor.ts +7 -4
  125. package/src/hooks/useRiveList.ts +108 -0
  126. package/src/hooks/useRiveProperty.ts +20 -13
  127. package/src/hooks/useViewModelInstance.ts +195 -0
  128. package/src/index.tsx +4 -0
  129. package/src/specs/ViewModel.nitro.ts +43 -15
  130. package/src/types.tsx +58 -3
@@ -13,15 +13,6 @@
13
13
  #include "HybridRiveSpecSwift.hpp"
14
14
  #include "HybridRiveFileFactorySpecSwift.hpp"
15
15
  #include "HybridRiveFileSpecSwift.hpp"
16
- #include "HybridViewModelSpecSwift.hpp"
17
- #include "HybridViewModelInstanceSpecSwift.hpp"
18
- #include "HybridViewModelNumberPropertySpecSwift.hpp"
19
- #include "HybridViewModelStringPropertySpecSwift.hpp"
20
- #include "HybridViewModelBooleanPropertySpecSwift.hpp"
21
- #include "HybridViewModelColorPropertySpecSwift.hpp"
22
- #include "HybridViewModelEnumPropertySpecSwift.hpp"
23
- #include "HybridViewModelTriggerPropertySpecSwift.hpp"
24
- #include "HybridViewModelImagePropertySpecSwift.hpp"
25
16
  #include "HybridRiveViewSpecSwift.hpp"
26
17
  #include "HybridRiveImageFactorySpecSwift.hpp"
27
18
 
@@ -55,69 +46,6 @@
55
46
  return hybridObject;
56
47
  }
57
48
  );
58
- HybridObjectRegistry::registerHybridObjectConstructor(
59
- "ViewModel",
60
- []() -> std::shared_ptr<HybridObject> {
61
- std::shared_ptr<HybridViewModelSpec> hybridObject = RNRive::RNRiveAutolinking::createViewModel();
62
- return hybridObject;
63
- }
64
- );
65
- HybridObjectRegistry::registerHybridObjectConstructor(
66
- "ViewModelInstance",
67
- []() -> std::shared_ptr<HybridObject> {
68
- std::shared_ptr<HybridViewModelInstanceSpec> hybridObject = RNRive::RNRiveAutolinking::createViewModelInstance();
69
- return hybridObject;
70
- }
71
- );
72
- HybridObjectRegistry::registerHybridObjectConstructor(
73
- "ViewModelNumberProperty",
74
- []() -> std::shared_ptr<HybridObject> {
75
- std::shared_ptr<HybridViewModelNumberPropertySpec> hybridObject = RNRive::RNRiveAutolinking::createViewModelNumberProperty();
76
- return hybridObject;
77
- }
78
- );
79
- HybridObjectRegistry::registerHybridObjectConstructor(
80
- "ViewModelStringProperty",
81
- []() -> std::shared_ptr<HybridObject> {
82
- std::shared_ptr<HybridViewModelStringPropertySpec> hybridObject = RNRive::RNRiveAutolinking::createViewModelStringProperty();
83
- return hybridObject;
84
- }
85
- );
86
- HybridObjectRegistry::registerHybridObjectConstructor(
87
- "ViewModelBooleanProperty",
88
- []() -> std::shared_ptr<HybridObject> {
89
- std::shared_ptr<HybridViewModelBooleanPropertySpec> hybridObject = RNRive::RNRiveAutolinking::createViewModelBooleanProperty();
90
- return hybridObject;
91
- }
92
- );
93
- HybridObjectRegistry::registerHybridObjectConstructor(
94
- "ViewModelColorProperty",
95
- []() -> std::shared_ptr<HybridObject> {
96
- std::shared_ptr<HybridViewModelColorPropertySpec> hybridObject = RNRive::RNRiveAutolinking::createViewModelColorProperty();
97
- return hybridObject;
98
- }
99
- );
100
- HybridObjectRegistry::registerHybridObjectConstructor(
101
- "ViewModelEnumProperty",
102
- []() -> std::shared_ptr<HybridObject> {
103
- std::shared_ptr<HybridViewModelEnumPropertySpec> hybridObject = RNRive::RNRiveAutolinking::createViewModelEnumProperty();
104
- return hybridObject;
105
- }
106
- );
107
- HybridObjectRegistry::registerHybridObjectConstructor(
108
- "ViewModelTriggerProperty",
109
- []() -> std::shared_ptr<HybridObject> {
110
- std::shared_ptr<HybridViewModelTriggerPropertySpec> hybridObject = RNRive::RNRiveAutolinking::createViewModelTriggerProperty();
111
- return hybridObject;
112
- }
113
- );
114
- HybridObjectRegistry::registerHybridObjectConstructor(
115
- "ViewModelImageProperty",
116
- []() -> std::shared_ptr<HybridObject> {
117
- std::shared_ptr<HybridViewModelImagePropertySpec> hybridObject = RNRive::RNRiveAutolinking::createViewModelImageProperty();
118
- return hybridObject;
119
- }
120
- );
121
49
  HybridObjectRegistry::registerHybridObjectConstructor(
122
50
  "RiveView",
123
51
  []() -> std::shared_ptr<HybridObject> {
@@ -53,141 +53,6 @@ public final class RNRiveAutolinking {
53
53
  }()
54
54
  }
55
55
 
56
- /**
57
- * Creates an instance of a Swift class that implements `HybridViewModelSpec`,
58
- * and wraps it in a Swift class that can directly interop with C++ (`HybridViewModelSpec_cxx`)
59
- *
60
- * This is generated by Nitrogen and will initialize the class specified
61
- * in the `"autolinking"` property of `nitro.json` (in this case, `HybridViewModel`).
62
- */
63
- public static func createViewModel() -> bridge.std__shared_ptr_HybridViewModelSpec_ {
64
- let hybridObject = HybridViewModel()
65
- return { () -> bridge.std__shared_ptr_HybridViewModelSpec_ in
66
- let __cxxWrapped = hybridObject.getCxxWrapper()
67
- return __cxxWrapped.getCxxPart()
68
- }()
69
- }
70
-
71
- /**
72
- * Creates an instance of a Swift class that implements `HybridViewModelInstanceSpec`,
73
- * and wraps it in a Swift class that can directly interop with C++ (`HybridViewModelInstanceSpec_cxx`)
74
- *
75
- * This is generated by Nitrogen and will initialize the class specified
76
- * in the `"autolinking"` property of `nitro.json` (in this case, `HybridViewModelInstance`).
77
- */
78
- public static func createViewModelInstance() -> bridge.std__shared_ptr_HybridViewModelInstanceSpec_ {
79
- let hybridObject = HybridViewModelInstance()
80
- return { () -> bridge.std__shared_ptr_HybridViewModelInstanceSpec_ in
81
- let __cxxWrapped = hybridObject.getCxxWrapper()
82
- return __cxxWrapped.getCxxPart()
83
- }()
84
- }
85
-
86
- /**
87
- * Creates an instance of a Swift class that implements `HybridViewModelNumberPropertySpec`,
88
- * and wraps it in a Swift class that can directly interop with C++ (`HybridViewModelNumberPropertySpec_cxx`)
89
- *
90
- * This is generated by Nitrogen and will initialize the class specified
91
- * in the `"autolinking"` property of `nitro.json` (in this case, `HybridViewModelNumberProperty`).
92
- */
93
- public static func createViewModelNumberProperty() -> bridge.std__shared_ptr_HybridViewModelNumberPropertySpec_ {
94
- let hybridObject = HybridViewModelNumberProperty()
95
- return { () -> bridge.std__shared_ptr_HybridViewModelNumberPropertySpec_ in
96
- let __cxxWrapped = hybridObject.getCxxWrapper()
97
- return __cxxWrapped.getCxxPart()
98
- }()
99
- }
100
-
101
- /**
102
- * Creates an instance of a Swift class that implements `HybridViewModelStringPropertySpec`,
103
- * and wraps it in a Swift class that can directly interop with C++ (`HybridViewModelStringPropertySpec_cxx`)
104
- *
105
- * This is generated by Nitrogen and will initialize the class specified
106
- * in the `"autolinking"` property of `nitro.json` (in this case, `HybridViewModelStringProperty`).
107
- */
108
- public static func createViewModelStringProperty() -> bridge.std__shared_ptr_HybridViewModelStringPropertySpec_ {
109
- let hybridObject = HybridViewModelStringProperty()
110
- return { () -> bridge.std__shared_ptr_HybridViewModelStringPropertySpec_ in
111
- let __cxxWrapped = hybridObject.getCxxWrapper()
112
- return __cxxWrapped.getCxxPart()
113
- }()
114
- }
115
-
116
- /**
117
- * Creates an instance of a Swift class that implements `HybridViewModelBooleanPropertySpec`,
118
- * and wraps it in a Swift class that can directly interop with C++ (`HybridViewModelBooleanPropertySpec_cxx`)
119
- *
120
- * This is generated by Nitrogen and will initialize the class specified
121
- * in the `"autolinking"` property of `nitro.json` (in this case, `HybridViewModelBooleanProperty`).
122
- */
123
- public static func createViewModelBooleanProperty() -> bridge.std__shared_ptr_HybridViewModelBooleanPropertySpec_ {
124
- let hybridObject = HybridViewModelBooleanProperty()
125
- return { () -> bridge.std__shared_ptr_HybridViewModelBooleanPropertySpec_ in
126
- let __cxxWrapped = hybridObject.getCxxWrapper()
127
- return __cxxWrapped.getCxxPart()
128
- }()
129
- }
130
-
131
- /**
132
- * Creates an instance of a Swift class that implements `HybridViewModelColorPropertySpec`,
133
- * and wraps it in a Swift class that can directly interop with C++ (`HybridViewModelColorPropertySpec_cxx`)
134
- *
135
- * This is generated by Nitrogen and will initialize the class specified
136
- * in the `"autolinking"` property of `nitro.json` (in this case, `HybridViewModelColorProperty`).
137
- */
138
- public static func createViewModelColorProperty() -> bridge.std__shared_ptr_HybridViewModelColorPropertySpec_ {
139
- let hybridObject = HybridViewModelColorProperty()
140
- return { () -> bridge.std__shared_ptr_HybridViewModelColorPropertySpec_ in
141
- let __cxxWrapped = hybridObject.getCxxWrapper()
142
- return __cxxWrapped.getCxxPart()
143
- }()
144
- }
145
-
146
- /**
147
- * Creates an instance of a Swift class that implements `HybridViewModelEnumPropertySpec`,
148
- * and wraps it in a Swift class that can directly interop with C++ (`HybridViewModelEnumPropertySpec_cxx`)
149
- *
150
- * This is generated by Nitrogen and will initialize the class specified
151
- * in the `"autolinking"` property of `nitro.json` (in this case, `HybridViewModelEnumProperty`).
152
- */
153
- public static func createViewModelEnumProperty() -> bridge.std__shared_ptr_HybridViewModelEnumPropertySpec_ {
154
- let hybridObject = HybridViewModelEnumProperty()
155
- return { () -> bridge.std__shared_ptr_HybridViewModelEnumPropertySpec_ in
156
- let __cxxWrapped = hybridObject.getCxxWrapper()
157
- return __cxxWrapped.getCxxPart()
158
- }()
159
- }
160
-
161
- /**
162
- * Creates an instance of a Swift class that implements `HybridViewModelTriggerPropertySpec`,
163
- * and wraps it in a Swift class that can directly interop with C++ (`HybridViewModelTriggerPropertySpec_cxx`)
164
- *
165
- * This is generated by Nitrogen and will initialize the class specified
166
- * in the `"autolinking"` property of `nitro.json` (in this case, `HybridViewModelTriggerProperty`).
167
- */
168
- public static func createViewModelTriggerProperty() -> bridge.std__shared_ptr_HybridViewModelTriggerPropertySpec_ {
169
- let hybridObject = HybridViewModelTriggerProperty()
170
- return { () -> bridge.std__shared_ptr_HybridViewModelTriggerPropertySpec_ in
171
- let __cxxWrapped = hybridObject.getCxxWrapper()
172
- return __cxxWrapped.getCxxPart()
173
- }()
174
- }
175
-
176
- /**
177
- * Creates an instance of a Swift class that implements `HybridViewModelImagePropertySpec`,
178
- * and wraps it in a Swift class that can directly interop with C++ (`HybridViewModelImagePropertySpec_cxx`)
179
- *
180
- * This is generated by Nitrogen and will initialize the class specified
181
- * in the `"autolinking"` property of `nitro.json` (in this case, `HybridViewModelImageProperty`).
182
- */
183
- public static func createViewModelImageProperty() -> bridge.std__shared_ptr_HybridViewModelImagePropertySpec_ {
184
- let hybridObject = HybridViewModelImageProperty()
185
- return { () -> bridge.std__shared_ptr_HybridViewModelImagePropertySpec_ in
186
- let __cxxWrapped = hybridObject.getCxxWrapper()
187
- return __cxxWrapped.getCxxPart()
188
- }()
189
- }
190
-
191
56
  /**
192
57
  * Creates an instance of a Swift class that implements `HybridRiveViewSpec`,
193
58
  * and wraps it in a Swift class that can directly interop with C++ (`HybridRiveViewSpec_cxx`)
@@ -68,11 +68,13 @@ namespace margelo::nitro::rive {
68
68
 
69
69
  public:
70
70
  // Methods
71
- inline void addListener(const std::function<void(bool /* value */)>& onChanged) override {
71
+ inline std::function<void()> addListener(const std::function<void(bool /* value */)>& onChanged) override {
72
72
  auto __result = _swiftPart.addListener(onChanged);
73
73
  if (__result.hasError()) [[unlikely]] {
74
74
  std::rethrow_exception(__result.error());
75
75
  }
76
+ auto __value = std::move(__result.value());
77
+ return __value;
76
78
  }
77
79
  inline void removeListeners() override {
78
80
  auto __result = _swiftPart.removeListeners();
@@ -68,11 +68,13 @@ namespace margelo::nitro::rive {
68
68
 
69
69
  public:
70
70
  // Methods
71
- inline void addListener(const std::function<void(double /* value */)>& onChanged) override {
71
+ inline std::function<void()> addListener(const std::function<void(double /* value */)>& onChanged) override {
72
72
  auto __result = _swiftPart.addListener(onChanged);
73
73
  if (__result.hasError()) [[unlikely]] {
74
74
  std::rethrow_exception(__result.error());
75
75
  }
76
+ auto __value = std::move(__result.value());
77
+ return __value;
76
78
  }
77
79
  inline void removeListeners() override {
78
80
  auto __result = _swiftPart.removeListeners();
@@ -70,11 +70,13 @@ namespace margelo::nitro::rive {
70
70
 
71
71
  public:
72
72
  // Methods
73
- inline void addListener(const std::function<void(const std::string& /* value */)>& onChanged) override {
73
+ inline std::function<void()> addListener(const std::function<void(const std::string& /* value */)>& onChanged) override {
74
74
  auto __result = _swiftPart.addListener(onChanged);
75
75
  if (__result.hasError()) [[unlikely]] {
76
76
  std::rethrow_exception(__result.error());
77
77
  }
78
+ auto __value = std::move(__result.value());
79
+ return __value;
78
80
  }
79
81
  inline void removeListeners() override {
80
82
  auto __result = _swiftPart.removeListeners();
@@ -74,11 +74,13 @@ namespace margelo::nitro::rive {
74
74
  std::rethrow_exception(__result.error());
75
75
  }
76
76
  }
77
- inline void addListener(const std::function<void()>& onChanged) override {
77
+ inline std::function<void()> addListener(const std::function<void()>& onChanged) override {
78
78
  auto __result = _swiftPart.addListener(onChanged);
79
79
  if (__result.hasError()) [[unlikely]] {
80
80
  std::rethrow_exception(__result.error());
81
81
  }
82
+ auto __value = std::move(__result.value());
83
+ return __value;
82
84
  }
83
85
  inline void removeListeners() override {
84
86
  auto __result = _swiftPart.removeListeners();
@@ -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
@@ -68,11 +68,13 @@ namespace margelo::nitro::rive {
68
68
 
69
69
  public:
70
70
  // Methods
71
- inline void addListener(const std::function<void(double /* value */)>& onChanged) override {
71
+ inline std::function<void()> addListener(const std::function<void(double /* value */)>& onChanged) override {
72
72
  auto __result = _swiftPart.addListener(onChanged);
73
73
  if (__result.hasError()) [[unlikely]] {
74
74
  std::rethrow_exception(__result.error());
75
75
  }
76
+ auto __value = std::move(__result.value());
77
+ return __value;
76
78
  }
77
79
  inline void removeListeners() override {
78
80
  auto __result = _swiftPart.removeListeners();
@@ -70,11 +70,13 @@ namespace margelo::nitro::rive {
70
70
 
71
71
  public:
72
72
  // Methods
73
- inline void addListener(const std::function<void(const std::string& /* value */)>& onChanged) override {
73
+ inline std::function<void()> addListener(const std::function<void(const std::string& /* value */)>& onChanged) override {
74
74
  auto __result = _swiftPart.addListener(onChanged);
75
75
  if (__result.hasError()) [[unlikely]] {
76
76
  std::rethrow_exception(__result.error());
77
77
  }
78
+ auto __value = std::move(__result.value());
79
+ return __value;
78
80
  }
79
81
  inline void removeListeners() override {
80
82
  auto __result = _swiftPart.removeListeners();
@@ -63,11 +63,13 @@ namespace margelo::nitro::rive {
63
63
 
64
64
  public:
65
65
  // Methods
66
- inline void addListener(const std::function<void()>& onChanged) override {
66
+ inline std::function<void()> addListener(const std::function<void()>& onChanged) override {
67
67
  auto __result = _swiftPart.addListener(onChanged);
68
68
  if (__result.hasError()) [[unlikely]] {
69
69
  std::rethrow_exception(__result.error());
70
70
  }
71
+ auto __value = std::move(__result.value());
72
+ return __value;
71
73
  }
72
74
  inline void trigger() override {
73
75
  auto __result = _swiftPart.trigger();
@@ -14,7 +14,7 @@ public protocol HybridViewModelBooleanPropertySpec_protocol: HybridObject, Hybri
14
14
  var value: Bool { get set }
15
15
 
16
16
  // Methods
17
- func addListener(onChanged: @escaping (_ value: Bool) -> Void) throws -> Void
17
+ func addListener(onChanged: @escaping (_ value: Bool) -> Void) throws -> () -> Void
18
18
  func removeListeners() throws -> Void
19
19
  }
20
20
 
@@ -130,18 +130,22 @@ open class HybridViewModelBooleanPropertySpec_cxx : HybridViewModelPropertySpec_
130
130
 
131
131
  // Methods
132
132
  @inline(__always)
133
- public final func addListener(onChanged: bridge.Func_void_bool) -> bridge.Result_void_ {
133
+ public final func addListener(onChanged: bridge.Func_void_bool) -> bridge.Result_std__function_void____ {
134
134
  do {
135
- try self.__implementation.addListener(onChanged: { () -> (Bool) -> Void in
135
+ let __result = try self.__implementation.addListener(onChanged: { () -> (Bool) -> Void in
136
136
  let __wrappedFunction = bridge.wrap_Func_void_bool(onChanged)
137
137
  return { (__value: Bool) -> Void in
138
138
  __wrappedFunction.call(__value)
139
139
  }
140
140
  }())
141
- return bridge.create_Result_void_()
141
+ let __resultCpp = { () -> bridge.Func_void in
142
+ let __closureWrapper = Func_void(__result)
143
+ return bridge.create_Func_void(__closureWrapper.toUnsafe())
144
+ }()
145
+ return bridge.create_Result_std__function_void____(__resultCpp)
142
146
  } catch (let __error) {
143
147
  let __exceptionPtr = __error.toCpp()
144
- return bridge.create_Result_void_(__exceptionPtr)
148
+ return bridge.create_Result_std__function_void____(__exceptionPtr)
145
149
  }
146
150
  }
147
151
 
@@ -14,7 +14,7 @@ public protocol HybridViewModelColorPropertySpec_protocol: HybridObject, HybridV
14
14
  var value: Double { get set }
15
15
 
16
16
  // Methods
17
- func addListener(onChanged: @escaping (_ value: Double) -> Void) throws -> Void
17
+ func addListener(onChanged: @escaping (_ value: Double) -> Void) throws -> () -> Void
18
18
  func removeListeners() throws -> Void
19
19
  }
20
20
 
@@ -130,18 +130,22 @@ open class HybridViewModelColorPropertySpec_cxx : HybridViewModelPropertySpec_cx
130
130
 
131
131
  // Methods
132
132
  @inline(__always)
133
- public final func addListener(onChanged: bridge.Func_void_double) -> bridge.Result_void_ {
133
+ public final func addListener(onChanged: bridge.Func_void_double) -> bridge.Result_std__function_void____ {
134
134
  do {
135
- try self.__implementation.addListener(onChanged: { () -> (Double) -> Void in
135
+ let __result = try self.__implementation.addListener(onChanged: { () -> (Double) -> Void in
136
136
  let __wrappedFunction = bridge.wrap_Func_void_double(onChanged)
137
137
  return { (__value: Double) -> Void in
138
138
  __wrappedFunction.call(__value)
139
139
  }
140
140
  }())
141
- return bridge.create_Result_void_()
141
+ let __resultCpp = { () -> bridge.Func_void in
142
+ let __closureWrapper = Func_void(__result)
143
+ return bridge.create_Func_void(__closureWrapper.toUnsafe())
144
+ }()
145
+ return bridge.create_Result_std__function_void____(__resultCpp)
142
146
  } catch (let __error) {
143
147
  let __exceptionPtr = __error.toCpp()
144
- return bridge.create_Result_void_(__exceptionPtr)
148
+ return bridge.create_Result_std__function_void____(__exceptionPtr)
145
149
  }
146
150
  }
147
151
 
@@ -14,7 +14,7 @@ public protocol HybridViewModelEnumPropertySpec_protocol: HybridObject, HybridVi
14
14
  var value: String { get set }
15
15
 
16
16
  // Methods
17
- func addListener(onChanged: @escaping (_ value: String) -> Void) throws -> Void
17
+ func addListener(onChanged: @escaping (_ value: String) -> Void) throws -> () -> Void
18
18
  func removeListeners() throws -> Void
19
19
  }
20
20
 
@@ -130,18 +130,22 @@ open class HybridViewModelEnumPropertySpec_cxx : HybridViewModelPropertySpec_cxx
130
130
 
131
131
  // Methods
132
132
  @inline(__always)
133
- public final func addListener(onChanged: bridge.Func_void_std__string) -> bridge.Result_void_ {
133
+ public final func addListener(onChanged: bridge.Func_void_std__string) -> bridge.Result_std__function_void____ {
134
134
  do {
135
- try self.__implementation.addListener(onChanged: { () -> (String) -> Void in
135
+ let __result = try self.__implementation.addListener(onChanged: { () -> (String) -> Void in
136
136
  let __wrappedFunction = bridge.wrap_Func_void_std__string(onChanged)
137
137
  return { (__value: String) -> Void in
138
138
  __wrappedFunction.call(std.string(__value))
139
139
  }
140
140
  }())
141
- return bridge.create_Result_void_()
141
+ let __resultCpp = { () -> bridge.Func_void in
142
+ let __closureWrapper = Func_void(__result)
143
+ return bridge.create_Func_void(__closureWrapper.toUnsafe())
144
+ }()
145
+ return bridge.create_Result_std__function_void____(__resultCpp)
142
146
  } catch (let __error) {
143
147
  let __exceptionPtr = __error.toCpp()
144
- return bridge.create_Result_void_(__exceptionPtr)
148
+ return bridge.create_Result_std__function_void____(__exceptionPtr)
145
149
  }
146
150
  }
147
151
 
@@ -15,7 +15,7 @@ public protocol HybridViewModelImagePropertySpec_protocol: HybridObject, HybridV
15
15
 
16
16
  // Methods
17
17
  func set(image: (any HybridRiveImageSpec)?) throws -> Void
18
- func addListener(onChanged: @escaping () -> Void) throws -> Void
18
+ func addListener(onChanged: @escaping () -> Void) throws -> () -> Void
19
19
  func removeListeners() throws -> Void
20
20
  }
21
21