react-native-spiral-image 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +39 -0
- package/SpiralImage.podspec +29 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +112 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +11 -0
- package/android/src/main/java/com/margelo/nitro/spiralimage/SpiralImage.kt +10 -0
- package/android/src/main/java/com/margelo/nitro/spiralimage/SpiralImagePackage.kt +22 -0
- package/ios/SpiralImage.swift +5 -0
- package/lib/module/SpiralImage.nitro.js +4 -0
- package/lib/module/SpiralImage.nitro.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/multiply.js +6 -0
- package/lib/module/multiply.js.map +1 -0
- package/lib/module/multiply.native.js +8 -0
- package/lib/module/multiply.native.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/SpiralImage.nitro.d.ts +8 -0
- package/lib/typescript/src/SpiralImage.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/multiply.d.ts +2 -0
- package/lib/typescript/src/multiply.d.ts.map +1 -0
- package/lib/typescript/src/multiply.native.d.ts +2 -0
- package/lib/typescript/src/multiply.native.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JHybridSpiralImageSpec.cpp +53 -0
- package/nitrogen/generated/android/c++/JHybridSpiralImageSpec.hpp +63 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/spiralimage/HybridSpiralImageSpec.kt +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/spiralimage/spiralimageOnLoad.kt +35 -0
- package/nitrogen/generated/android/spiralimage+autolinking.cmake +81 -0
- package/nitrogen/generated/android/spiralimage+autolinking.gradle +27 -0
- package/nitrogen/generated/android/spiralimageOnLoad.cpp +54 -0
- package/nitrogen/generated/android/spiralimageOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/SpiralImage+autolinking.rb +62 -0
- package/nitrogen/generated/ios/SpiralImage-Swift-Cxx-Bridge.cpp +33 -0
- package/nitrogen/generated/ios/SpiralImage-Swift-Cxx-Bridge.hpp +51 -0
- package/nitrogen/generated/ios/SpiralImage-Swift-Cxx-Umbrella.hpp +43 -0
- package/nitrogen/generated/ios/SpiralImageAutolinking.mm +33 -0
- package/nitrogen/generated/ios/SpiralImageAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridSpiralImageSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridSpiralImageSpecSwift.hpp +82 -0
- package/nitrogen/generated/ios/swift/HybridSpiralImageSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridSpiralImageSpec_cxx.swift +138 -0
- package/nitrogen/generated/shared/c++/HybridSpiralImageSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridSpiralImageSpec.hpp +62 -0
- package/package.json +184 -0
- package/src/SpiralImage.nitro.ts +8 -0
- package/src/index.tsx +1 -0
- package/src/multiply.native.tsx +9 -0
- package/src/multiply.tsx +3 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#
|
|
2
|
+
# spiralimage+autolinking.cmake
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a CMake file that adds all files generated by Nitrogen
|
|
9
|
+
# to the current CMake project.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your CMakeLists.txt:
|
|
12
|
+
# ```cmake
|
|
13
|
+
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/spiralimage+autolinking.cmake)
|
|
14
|
+
# ```
|
|
15
|
+
|
|
16
|
+
# Define a flag to check if we are building properly
|
|
17
|
+
add_definitions(-DBUILDING_SPIRALIMAGE_WITH_GENERATED_CMAKE_PROJECT)
|
|
18
|
+
|
|
19
|
+
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
20
|
+
add_definitions(-DRN_SERIALIZABLE_STATE)
|
|
21
|
+
|
|
22
|
+
# Add all headers that were generated by Nitrogen
|
|
23
|
+
include_directories(
|
|
24
|
+
"../nitrogen/generated/shared/c++"
|
|
25
|
+
"../nitrogen/generated/android/c++"
|
|
26
|
+
"../nitrogen/generated/android/"
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Add all .cpp sources that were generated by Nitrogen
|
|
30
|
+
target_sources(
|
|
31
|
+
# CMake project name (Android C++ library name)
|
|
32
|
+
spiralimage PRIVATE
|
|
33
|
+
# Autolinking Setup
|
|
34
|
+
../nitrogen/generated/android/spiralimageOnLoad.cpp
|
|
35
|
+
# Shared Nitrogen C++ sources
|
|
36
|
+
../nitrogen/generated/shared/c++/HybridSpiralImageSpec.cpp
|
|
37
|
+
# Android-specific Nitrogen C++ sources
|
|
38
|
+
../nitrogen/generated/android/c++/JHybridSpiralImageSpec.cpp
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
42
|
+
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
43
|
+
target_compile_definitions(
|
|
44
|
+
spiralimage PRIVATE
|
|
45
|
+
-DFOLLY_NO_CONFIG=1
|
|
46
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
47
|
+
-DFOLLY_USE_LIBCPP=1
|
|
48
|
+
-DFOLLY_CFG_NO_COROUTINES=1
|
|
49
|
+
-DFOLLY_MOBILE=1
|
|
50
|
+
-DFOLLY_HAVE_RECVMMSG=1
|
|
51
|
+
-DFOLLY_HAVE_PTHREAD=1
|
|
52
|
+
# Once we target android-23 above, we can comment
|
|
53
|
+
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
54
|
+
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Add all libraries required by the generated specs
|
|
58
|
+
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
59
|
+
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
60
|
+
find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
|
|
61
|
+
|
|
62
|
+
# Link all libraries together
|
|
63
|
+
target_link_libraries(
|
|
64
|
+
spiralimage
|
|
65
|
+
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
66
|
+
ReactAndroid::jsi # <-- RN: JSI
|
|
67
|
+
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
71
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
72
|
+
target_link_libraries(
|
|
73
|
+
spiralimage
|
|
74
|
+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
75
|
+
)
|
|
76
|
+
else()
|
|
77
|
+
target_link_libraries(
|
|
78
|
+
spiralimage
|
|
79
|
+
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
80
|
+
)
|
|
81
|
+
endif()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// spiralimage+autolinking.gradle
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
9
|
+
/// to the current Gradle project.
|
|
10
|
+
///
|
|
11
|
+
/// To use it, add this to your build.gradle:
|
|
12
|
+
/// ```gradle
|
|
13
|
+
/// apply from: '../nitrogen/generated/android/spiralimage+autolinking.gradle'
|
|
14
|
+
/// ```
|
|
15
|
+
|
|
16
|
+
logger.warn("[NitroModules] 🔥 spiralimage is boosted by nitro!")
|
|
17
|
+
|
|
18
|
+
android {
|
|
19
|
+
sourceSets {
|
|
20
|
+
main {
|
|
21
|
+
java.srcDirs += [
|
|
22
|
+
// Nitrogen files
|
|
23
|
+
"${project.projectDir}/../nitrogen/generated/android/kotlin"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// spiralimageOnLoad.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#ifndef BUILDING_SPIRALIMAGE_WITH_GENERATED_CMAKE_PROJECT
|
|
9
|
+
#error spiralimageOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#include "spiralimageOnLoad.hpp"
|
|
13
|
+
|
|
14
|
+
#include <jni.h>
|
|
15
|
+
#include <fbjni/fbjni.h>
|
|
16
|
+
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
|
+
|
|
18
|
+
#include "JHybridSpiralImageSpec.hpp"
|
|
19
|
+
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::spiralimage {
|
|
22
|
+
|
|
23
|
+
int initialize(JavaVM* vm) {
|
|
24
|
+
return facebook::jni::initialize(vm, []() {
|
|
25
|
+
::margelo::nitro::spiralimage::registerAllNatives();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
struct JHybridSpiralImageSpecImpl: public jni::JavaClass<JHybridSpiralImageSpecImpl, JHybridSpiralImageSpec::JavaPart> {
|
|
30
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/spiralimage/SpiralImage;";
|
|
31
|
+
static std::shared_ptr<JHybridSpiralImageSpec> create() {
|
|
32
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridSpiralImageSpecImpl::javaobject()>();
|
|
33
|
+
jni::local_ref<JHybridSpiralImageSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
34
|
+
return javaPart->getJHybridSpiralImageSpec();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
void registerAllNatives() {
|
|
39
|
+
using namespace margelo::nitro;
|
|
40
|
+
using namespace margelo::nitro::spiralimage;
|
|
41
|
+
|
|
42
|
+
// Register native JNI methods
|
|
43
|
+
margelo::nitro::spiralimage::JHybridSpiralImageSpec::CxxPart::registerNatives();
|
|
44
|
+
|
|
45
|
+
// Register Nitro Hybrid Objects
|
|
46
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
47
|
+
"SpiralImage",
|
|
48
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
49
|
+
return JHybridSpiralImageSpecImpl::create();
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::spiralimage
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// spiralimageOnLoad.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include <jni.h>
|
|
9
|
+
#include <functional>
|
|
10
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
|
|
12
|
+
namespace margelo::nitro::spiralimage {
|
|
13
|
+
|
|
14
|
+
[[deprecated("Use registerNatives() instead.")]]
|
|
15
|
+
int initialize(JavaVM* vm);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Register the native (C++) part of spiralimage, and autolinks all Hybrid Objects.
|
|
19
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
|
|
20
|
+
* inside a `facebook::jni::initialize(vm, ...)` call.
|
|
21
|
+
* Example:
|
|
22
|
+
* ```cpp (cpp-adapter.cpp)
|
|
23
|
+
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
24
|
+
* return facebook::jni::initialize(vm, []() {
|
|
25
|
+
* // register all spiralimage HybridObjects
|
|
26
|
+
* margelo::nitro::spiralimage::registerNatives();
|
|
27
|
+
* // any other custom registrations go here.
|
|
28
|
+
* });
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
void registerAllNatives();
|
|
33
|
+
|
|
34
|
+
} // namespace margelo::nitro::spiralimage
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#
|
|
2
|
+
# SpiralImage+autolinking.rb
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/SpiralImage+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 SpiralImage is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/SpiralImage-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
# Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
|
|
60
|
+
"SWIFT_INSTALL_OBJC_HEADER" => "NO",
|
|
61
|
+
})
|
|
62
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SpiralImage-Swift-Cxx-Bridge.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "SpiralImage-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridSpiralImageSpecSwift.hpp"
|
|
12
|
+
#include "SpiralImage-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::spiralimage::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::shared_ptr<HybridSpiralImageSpec>
|
|
18
|
+
std::shared_ptr<HybridSpiralImageSpec> create_std__shared_ptr_HybridSpiralImageSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
19
|
+
SpiralImage::HybridSpiralImageSpec_cxx swiftPart = SpiralImage::HybridSpiralImageSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
20
|
+
return std::make_shared<margelo::nitro::spiralimage::HybridSpiralImageSpecSwift>(swiftPart);
|
|
21
|
+
}
|
|
22
|
+
void* NON_NULL get_std__shared_ptr_HybridSpiralImageSpec_(std__shared_ptr_HybridSpiralImageSpec_ cppType) {
|
|
23
|
+
std::shared_ptr<margelo::nitro::spiralimage::HybridSpiralImageSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::spiralimage::HybridSpiralImageSpecSwift>(cppType);
|
|
24
|
+
#ifdef NITRO_DEBUG
|
|
25
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
26
|
+
throw std::runtime_error("Class \"HybridSpiralImageSpec\" is not implemented in Swift!");
|
|
27
|
+
}
|
|
28
|
+
#endif
|
|
29
|
+
SpiralImage::HybridSpiralImageSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
30
|
+
return swiftPart.toUnsafe();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
} // namespace margelo::nitro::spiralimage::bridge::swift
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SpiralImage-Swift-Cxx-Bridge.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridSpiralImageSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::spiralimage { class HybridSpiralImageSpec; }
|
|
13
|
+
|
|
14
|
+
// Forward declarations of Swift defined types
|
|
15
|
+
// Forward declaration of `HybridSpiralImageSpec_cxx` to properly resolve imports.
|
|
16
|
+
namespace SpiralImage { class HybridSpiralImageSpec_cxx; }
|
|
17
|
+
|
|
18
|
+
// Include C++ defined types
|
|
19
|
+
#include "HybridSpiralImageSpec.hpp"
|
|
20
|
+
#include <NitroModules/Result.hpp>
|
|
21
|
+
#include <exception>
|
|
22
|
+
#include <memory>
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
26
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
27
|
+
*/
|
|
28
|
+
namespace margelo::nitro::spiralimage::bridge::swift {
|
|
29
|
+
|
|
30
|
+
// pragma MARK: std::shared_ptr<HybridSpiralImageSpec>
|
|
31
|
+
/**
|
|
32
|
+
* Specialized version of `std::shared_ptr<HybridSpiralImageSpec>`.
|
|
33
|
+
*/
|
|
34
|
+
using std__shared_ptr_HybridSpiralImageSpec_ = std::shared_ptr<HybridSpiralImageSpec>;
|
|
35
|
+
std::shared_ptr<HybridSpiralImageSpec> create_std__shared_ptr_HybridSpiralImageSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
36
|
+
void* NON_NULL get_std__shared_ptr_HybridSpiralImageSpec_(std__shared_ptr_HybridSpiralImageSpec_ cppType);
|
|
37
|
+
|
|
38
|
+
// pragma MARK: std::weak_ptr<HybridSpiralImageSpec>
|
|
39
|
+
using std__weak_ptr_HybridSpiralImageSpec_ = std::weak_ptr<HybridSpiralImageSpec>;
|
|
40
|
+
inline std__weak_ptr_HybridSpiralImageSpec_ weakify_std__shared_ptr_HybridSpiralImageSpec_(const std::shared_ptr<HybridSpiralImageSpec>& strong) noexcept { return strong; }
|
|
41
|
+
|
|
42
|
+
// pragma MARK: Result<double>
|
|
43
|
+
using Result_double_ = Result<double>;
|
|
44
|
+
inline Result_double_ create_Result_double_(double value) noexcept {
|
|
45
|
+
return Result<double>::withValue(std::move(value));
|
|
46
|
+
}
|
|
47
|
+
inline Result_double_ create_Result_double_(const std::exception_ptr& error) noexcept {
|
|
48
|
+
return Result<double>::withError(error);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
} // namespace margelo::nitro::spiralimage::bridge::swift
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SpiralImage-Swift-Cxx-Umbrella.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridSpiralImageSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::spiralimage { class HybridSpiralImageSpec; }
|
|
13
|
+
|
|
14
|
+
// Include C++ defined types
|
|
15
|
+
#include "HybridSpiralImageSpec.hpp"
|
|
16
|
+
#include <NitroModules/Result.hpp>
|
|
17
|
+
#include <exception>
|
|
18
|
+
#include <memory>
|
|
19
|
+
|
|
20
|
+
// C++ helpers for Swift
|
|
21
|
+
#include "SpiralImage-Swift-Cxx-Bridge.hpp"
|
|
22
|
+
|
|
23
|
+
// Common C++ types used in Swift
|
|
24
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
25
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
26
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
27
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
28
|
+
|
|
29
|
+
// Forward declarations of Swift defined types
|
|
30
|
+
// Forward declaration of `HybridSpiralImageSpec_cxx` to properly resolve imports.
|
|
31
|
+
namespace SpiralImage { class HybridSpiralImageSpec_cxx; }
|
|
32
|
+
|
|
33
|
+
// Include Swift defined types
|
|
34
|
+
#if __has_include("SpiralImage-Swift.h")
|
|
35
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
36
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "SpiralImage".
|
|
37
|
+
#include "SpiralImage-Swift.h"
|
|
38
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
39
|
+
#elif __has_include(<SpiralImage/SpiralImage-Swift.h>)
|
|
40
|
+
#include <SpiralImage/SpiralImage-Swift.h>
|
|
41
|
+
#else
|
|
42
|
+
#error SpiralImage's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "SpiralImage", and try building the app first.
|
|
43
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SpiralImageAutolinking.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
#import "SpiralImage-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridSpiralImageSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface SpiralImageAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation SpiralImageAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::spiralimage;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"SpiralImage",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridSpiralImageSpec> hybridObject = SpiralImage::SpiralImageAutolinking::createSpiralImage();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// SpiralImageAutolinking.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
|
+
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
+
public final class SpiralImageAutolinking {
|
|
13
|
+
public typealias bridge = margelo.nitro.spiralimage.bridge.swift
|
|
14
|
+
|
|
15
|
+
public static func createSpiralImage() -> bridge.std__shared_ptr_HybridSpiralImageSpec_ {
|
|
16
|
+
let hybridObject = SpiralImage()
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridSpiralImageSpec_ in
|
|
18
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
|
+
return __cxxWrapped.getCxxPart()
|
|
20
|
+
}()
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public static func isSpiralImageRecyclable() -> Bool {
|
|
24
|
+
return SpiralImage.self is any RecyclableView.Type
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSpiralImageSpecSwift.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridSpiralImageSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::spiralimage {
|
|
11
|
+
} // namespace margelo::nitro::spiralimage
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSpiralImageSpecSwift.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "HybridSpiralImageSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridSpiralImageSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace SpiralImage { class HybridSpiralImageSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
#include "SpiralImage-Swift-Cxx-Umbrella.hpp"
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::spiralimage {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The C++ part of HybridSpiralImageSpec_cxx.swift.
|
|
25
|
+
*
|
|
26
|
+
* HybridSpiralImageSpecSwift (C++) accesses HybridSpiralImageSpec_cxx (Swift), and might
|
|
27
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
28
|
+
*
|
|
29
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
30
|
+
* the future, HybridSpiralImageSpec_cxx can directly inherit from the C++ class HybridSpiralImageSpec
|
|
31
|
+
* to simplify the whole structure and memory management.
|
|
32
|
+
*/
|
|
33
|
+
class HybridSpiralImageSpecSwift: public virtual HybridSpiralImageSpec {
|
|
34
|
+
public:
|
|
35
|
+
// Constructor from a Swift instance
|
|
36
|
+
explicit HybridSpiralImageSpecSwift(const SpiralImage::HybridSpiralImageSpec_cxx& swiftPart):
|
|
37
|
+
HybridObject(HybridSpiralImageSpec::TAG),
|
|
38
|
+
_swiftPart(swiftPart) { }
|
|
39
|
+
|
|
40
|
+
public:
|
|
41
|
+
// Get the Swift part
|
|
42
|
+
inline SpiralImage::HybridSpiralImageSpec_cxx& getSwiftPart() noexcept {
|
|
43
|
+
return _swiftPart;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
48
|
+
return _swiftPart.getMemorySize();
|
|
49
|
+
}
|
|
50
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
51
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridSpiralImageSpecSwift>(other)) {
|
|
52
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
void dispose() noexcept override {
|
|
57
|
+
_swiftPart.dispose();
|
|
58
|
+
}
|
|
59
|
+
std::string toString() override {
|
|
60
|
+
return _swiftPart.toString();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
// Properties
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
public:
|
|
68
|
+
// Methods
|
|
69
|
+
inline double multiply(double a, double b) override {
|
|
70
|
+
auto __result = _swiftPart.multiply(std::forward<decltype(a)>(a), std::forward<decltype(b)>(b));
|
|
71
|
+
if (__result.hasError()) [[unlikely]] {
|
|
72
|
+
std::rethrow_exception(__result.error());
|
|
73
|
+
}
|
|
74
|
+
auto __value = std::move(__result.value());
|
|
75
|
+
return __value;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private:
|
|
79
|
+
SpiralImage::HybridSpiralImageSpec_cxx _swiftPart;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
} // namespace margelo::nitro::spiralimage
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSpiralImageSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/// See ``HybridSpiralImageSpec``
|
|
11
|
+
public protocol HybridSpiralImageSpec_protocol: HybridObject {
|
|
12
|
+
// Properties
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
// Methods
|
|
16
|
+
func multiply(a: Double, b: Double) throws -> Double
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public extension HybridSpiralImageSpec_protocol {
|
|
20
|
+
/// Default implementation of ``HybridObject.toString``
|
|
21
|
+
func toString() -> String {
|
|
22
|
+
return "[HybridObject SpiralImage]"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/// See ``HybridSpiralImageSpec``
|
|
27
|
+
open class HybridSpiralImageSpec_base {
|
|
28
|
+
private weak var cxxWrapper: HybridSpiralImageSpec_cxx? = nil
|
|
29
|
+
public init() { }
|
|
30
|
+
public func getCxxWrapper() -> HybridSpiralImageSpec_cxx {
|
|
31
|
+
#if DEBUG
|
|
32
|
+
guard self is any HybridSpiralImageSpec else {
|
|
33
|
+
fatalError("`self` is not a `HybridSpiralImageSpec`! Did you accidentally inherit from `HybridSpiralImageSpec_base` instead of `HybridSpiralImageSpec`?")
|
|
34
|
+
}
|
|
35
|
+
#endif
|
|
36
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
37
|
+
return cxxWrapper
|
|
38
|
+
} else {
|
|
39
|
+
let cxxWrapper = HybridSpiralImageSpec_cxx(self as! any HybridSpiralImageSpec)
|
|
40
|
+
self.cxxWrapper = cxxWrapper
|
|
41
|
+
return cxxWrapper
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A Swift base-protocol representing the SpiralImage HybridObject.
|
|
48
|
+
* Implement this protocol to create Swift-based instances of SpiralImage.
|
|
49
|
+
* ```swift
|
|
50
|
+
* class HybridSpiralImage : HybridSpiralImageSpec {
|
|
51
|
+
* // ...
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
public typealias HybridSpiralImageSpec = HybridSpiralImageSpec_protocol & HybridSpiralImageSpec_base
|