react-native-nitro-modal 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/NitroModal.podspec +29 -0
- package/README.md +39 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +124 -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/nitromodal/BottomSheetPresenter.kt +284 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/HybridNitroModal.kt +312 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalConfig.kt +50 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalContentRoot.kt +115 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/ModalPresenter.kt +253 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/NitroModalHostView.kt +52 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/NitroModalPackage.kt +28 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/NitroModalViewManager.kt +67 -0
- package/android/src/main/java/com/margelo/nitro/nitromodal/PopupPresenter.kt +156 -0
- package/android/src/main/res/values/styles.xml +17 -0
- package/ios/BackdropView.swift +64 -0
- package/ios/HybridNitroModal.swift +329 -0
- package/ios/HybridNitroModalComponent+Children.mm +77 -0
- package/ios/ModalConfig.swift +73 -0
- package/ios/NitroModalHostView.swift +91 -0
- package/ios/PopupViewController.swift +223 -0
- package/ios/SheetViewController.swift +244 -0
- package/lib/module/NitroModal.js +188 -0
- package/lib/module/NitroModal.js.map +1 -0
- package/lib/module/NitroModal.nitro.js +4 -0
- package/lib/module/NitroModal.nitro.js.map +1 -0
- package/lib/module/NitroModalView.js +17 -0
- package/lib/module/NitroModalView.js.map +1 -0
- package/lib/module/NitroModalView.native.js +6 -0
- package/lib/module/NitroModalView.native.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NitroModal.d.ts +59 -0
- package/lib/typescript/src/NitroModal.d.ts.map +1 -0
- package/lib/typescript/src/NitroModal.nitro.d.ts +78 -0
- package/lib/typescript/src/NitroModal.nitro.d.ts.map +1 -0
- package/lib/typescript/src/NitroModalView.d.ts +4 -0
- package/lib/typescript/src/NitroModalView.d.ts.map +1 -0
- package/lib/typescript/src/NitroModalView.native.d.ts +3 -0
- package/lib/typescript/src/NitroModalView.native.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JDismissReason.hpp +64 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_DismissReason.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_ModalContentArea.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
- package/nitrogen/generated/android/c++/JHybridNitroModalSpec.cpp +344 -0
- package/nitrogen/generated/android/c++/JHybridNitroModalSpec.hpp +106 -0
- package/nitrogen/generated/android/c++/JKeyboardBehavior.hpp +61 -0
- package/nitrogen/generated/android/c++/JModalContentArea.hpp +61 -0
- package/nitrogen/generated/android/c++/JModalMode.hpp +58 -0
- package/nitrogen/generated/android/c++/JPopupAnimation.hpp +61 -0
- package/nitrogen/generated/android/c++/JSheetDetent.hpp +64 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroModalStateUpdater.cpp +174 -0
- package/nitrogen/generated/android/c++/views/JHybridNitroModalStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/DismissReason.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/Func_void.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/Func_void_DismissReason.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/Func_void_ModalContentArea.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/Func_void_double.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/HybridNitroModalSpec.kt +237 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/KeyboardBehavior.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/ModalContentArea.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/ModalMode.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/PopupAnimation.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/SheetDetent.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/nitromodalOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/views/HybridNitroModalManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitromodal/views/HybridNitroModalStateUpdater.kt +23 -0
- package/nitrogen/generated/android/nitromodal+autolinking.cmake +83 -0
- package/nitrogen/generated/android/nitromodal+autolinking.gradle +27 -0
- package/nitrogen/generated/android/nitromodalOnLoad.cpp +64 -0
- package/nitrogen/generated/android/nitromodalOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/NitroModal+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroModal-Swift-Cxx-Bridge.cpp +65 -0
- package/nitrogen/generated/ios/NitroModal-Swift-Cxx-Bridge.hpp +237 -0
- package/nitrogen/generated/ios/NitroModal-Swift-Cxx-Umbrella.hpp +64 -0
- package/nitrogen/generated/ios/NitroModalAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroModalAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridNitroModalSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridNitroModalSpecSwift.hpp +247 -0
- package/nitrogen/generated/ios/c++/views/HybridNitroModalComponent.mm +264 -0
- package/nitrogen/generated/ios/swift/DismissReason.swift +48 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_DismissReason.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_ModalContentArea.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridNitroModalSpec.swift +77 -0
- package/nitrogen/generated/ios/swift/HybridNitroModalSpec_cxx.swift +554 -0
- package/nitrogen/generated/ios/swift/KeyboardBehavior.swift +44 -0
- package/nitrogen/generated/ios/swift/ModalContentArea.swift +34 -0
- package/nitrogen/generated/ios/swift/ModalMode.swift +40 -0
- package/nitrogen/generated/ios/swift/PopupAnimation.swift +44 -0
- package/nitrogen/generated/ios/swift/SheetDetent.swift +48 -0
- package/nitrogen/generated/shared/c++/DismissReason.hpp +84 -0
- package/nitrogen/generated/shared/c++/HybridNitroModalSpec.cpp +65 -0
- package/nitrogen/generated/shared/c++/HybridNitroModalSpec.hpp +124 -0
- package/nitrogen/generated/shared/c++/KeyboardBehavior.hpp +80 -0
- package/nitrogen/generated/shared/c++/ModalContentArea.hpp +87 -0
- package/nitrogen/generated/shared/c++/ModalMode.hpp +76 -0
- package/nitrogen/generated/shared/c++/PopupAnimation.hpp +80 -0
- package/nitrogen/generated/shared/c++/SheetDetent.hpp +84 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroModalComponent.cpp +74 -0
- package/nitrogen/generated/shared/c++/views/HybridNitroModalComponent.hpp +151 -0
- package/nitrogen/generated/shared/json/NitroModalConfig.json +30 -0
- package/package.json +183 -0
- package/src/NitroModal.nitro.ts +92 -0
- package/src/NitroModal.tsx +292 -0
- package/src/NitroModalView.native.tsx +8 -0
- package/src/NitroModalView.tsx +24 -0
- package/src/index.tsx +12 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
#
|
|
2
|
+
# nitromodal+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/nitromodal+autolinking.cmake)
|
|
14
|
+
# ```
|
|
15
|
+
|
|
16
|
+
# Define a flag to check if we are building properly
|
|
17
|
+
add_definitions(-DBUILDING_NITROMODAL_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
|
+
nitromodal PRIVATE
|
|
33
|
+
# Autolinking Setup
|
|
34
|
+
../nitrogen/generated/android/nitromodalOnLoad.cpp
|
|
35
|
+
# Shared Nitrogen C++ sources
|
|
36
|
+
../nitrogen/generated/shared/c++/HybridNitroModalSpec.cpp
|
|
37
|
+
../nitrogen/generated/shared/c++/views/HybridNitroModalComponent.cpp
|
|
38
|
+
# Android-specific Nitrogen C++ sources
|
|
39
|
+
../nitrogen/generated/android/c++/JHybridNitroModalSpec.cpp
|
|
40
|
+
../nitrogen/generated/android/c++/views/JHybridNitroModalStateUpdater.cpp
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
44
|
+
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
45
|
+
target_compile_definitions(
|
|
46
|
+
nitromodal PRIVATE
|
|
47
|
+
-DFOLLY_NO_CONFIG=1
|
|
48
|
+
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
49
|
+
-DFOLLY_USE_LIBCPP=1
|
|
50
|
+
-DFOLLY_CFG_NO_COROUTINES=1
|
|
51
|
+
-DFOLLY_MOBILE=1
|
|
52
|
+
-DFOLLY_HAVE_RECVMMSG=1
|
|
53
|
+
-DFOLLY_HAVE_PTHREAD=1
|
|
54
|
+
# Once we target android-23 above, we can comment
|
|
55
|
+
# the following line. NDK uses GNU style stderror_r() after API 23.
|
|
56
|
+
-DFOLLY_HAVE_XSI_STRERROR_R=1
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Add all libraries required by the generated specs
|
|
60
|
+
find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
|
|
61
|
+
find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
|
|
62
|
+
find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
|
|
63
|
+
|
|
64
|
+
# Link all libraries together
|
|
65
|
+
target_link_libraries(
|
|
66
|
+
nitromodal
|
|
67
|
+
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
68
|
+
ReactAndroid::jsi # <-- RN: JSI
|
|
69
|
+
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
73
|
+
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
74
|
+
target_link_libraries(
|
|
75
|
+
nitromodal
|
|
76
|
+
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
77
|
+
)
|
|
78
|
+
else()
|
|
79
|
+
target_link_libraries(
|
|
80
|
+
nitromodal
|
|
81
|
+
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
82
|
+
)
|
|
83
|
+
endif()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// nitromodal+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/nitromodal+autolinking.gradle'
|
|
14
|
+
/// ```
|
|
15
|
+
|
|
16
|
+
logger.warn("[NitroModules] 🔥 nitromodal 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,64 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// nitromodalOnLoad.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_NITROMODAL_WITH_GENERATED_CMAKE_PROJECT
|
|
9
|
+
#error nitromodalOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
|
|
10
|
+
#endif
|
|
11
|
+
|
|
12
|
+
#include "nitromodalOnLoad.hpp"
|
|
13
|
+
|
|
14
|
+
#include <jni.h>
|
|
15
|
+
#include <fbjni/fbjni.h>
|
|
16
|
+
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
|
+
|
|
18
|
+
#include "JHybridNitroModalSpec.hpp"
|
|
19
|
+
#include "JFunc_void.hpp"
|
|
20
|
+
#include "JFunc_void_DismissReason.hpp"
|
|
21
|
+
#include "JFunc_void_double.hpp"
|
|
22
|
+
#include "JFunc_void_ModalContentArea.hpp"
|
|
23
|
+
#include "views/JHybridNitroModalStateUpdater.hpp"
|
|
24
|
+
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::nitromodal {
|
|
27
|
+
|
|
28
|
+
int initialize(JavaVM* vm) {
|
|
29
|
+
return facebook::jni::initialize(vm, []() {
|
|
30
|
+
::margelo::nitro::nitromodal::registerAllNatives();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
struct JHybridNitroModalSpecImpl: public jni::JavaClass<JHybridNitroModalSpecImpl, JHybridNitroModalSpec::JavaPart> {
|
|
35
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitromodal/HybridNitroModal;";
|
|
36
|
+
static std::shared_ptr<JHybridNitroModalSpec> create() {
|
|
37
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridNitroModalSpecImpl::javaobject()>();
|
|
38
|
+
jni::local_ref<JHybridNitroModalSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
39
|
+
return javaPart->getJHybridNitroModalSpec();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
void registerAllNatives() {
|
|
44
|
+
using namespace margelo::nitro;
|
|
45
|
+
using namespace margelo::nitro::nitromodal;
|
|
46
|
+
|
|
47
|
+
// Register native JNI methods
|
|
48
|
+
margelo::nitro::nitromodal::JHybridNitroModalSpec::CxxPart::registerNatives();
|
|
49
|
+
margelo::nitro::nitromodal::JFunc_void_cxx::registerNatives();
|
|
50
|
+
margelo::nitro::nitromodal::JFunc_void_DismissReason_cxx::registerNatives();
|
|
51
|
+
margelo::nitro::nitromodal::JFunc_void_double_cxx::registerNatives();
|
|
52
|
+
margelo::nitro::nitromodal::JFunc_void_ModalContentArea_cxx::registerNatives();
|
|
53
|
+
margelo::nitro::nitromodal::views::JHybridNitroModalStateUpdater::registerNatives();
|
|
54
|
+
|
|
55
|
+
// Register Nitro Hybrid Objects
|
|
56
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
57
|
+
"NitroModal",
|
|
58
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
59
|
+
return JHybridNitroModalSpecImpl::create();
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
} // namespace margelo::nitro::nitromodal
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// nitromodalOnLoad.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::nitromodal {
|
|
13
|
+
|
|
14
|
+
[[deprecated("Use registerNatives() instead.")]]
|
|
15
|
+
int initialize(JavaVM* vm);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Register the native (C++) part of nitromodal, 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 nitromodal HybridObjects
|
|
26
|
+
* margelo::nitro::nitromodal::registerNatives();
|
|
27
|
+
* // any other custom registrations go here.
|
|
28
|
+
* });
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
void registerAllNatives();
|
|
33
|
+
|
|
34
|
+
} // namespace margelo::nitro::nitromodal
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#
|
|
2
|
+
# NitroModal+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/NitroModal+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 NitroModal 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/NitroModal-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,65 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroModal-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 "NitroModal-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridNitroModalSpecSwift.hpp"
|
|
12
|
+
#include "NitroModal-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::nitromodal::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::function<void()>
|
|
18
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = NitroModal::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
21
|
+
swiftClosure.call();
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// pragma MARK: std::function<void(DismissReason /* reason */)>
|
|
26
|
+
Func_void_DismissReason create_Func_void_DismissReason(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
27
|
+
auto swiftClosure = NitroModal::Func_void_DismissReason::fromUnsafe(swiftClosureWrapper);
|
|
28
|
+
return [swiftClosure = std::move(swiftClosure)](DismissReason reason) mutable -> void {
|
|
29
|
+
swiftClosure.call(static_cast<int>(reason));
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// pragma MARK: std::function<void(double /* index */)>
|
|
34
|
+
Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
35
|
+
auto swiftClosure = NitroModal::Func_void_double::fromUnsafe(swiftClosureWrapper);
|
|
36
|
+
return [swiftClosure = std::move(swiftClosure)](double index) mutable -> void {
|
|
37
|
+
swiftClosure.call(index);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// pragma MARK: std::function<void(const ModalContentArea& /* area */)>
|
|
42
|
+
Func_void_ModalContentArea create_Func_void_ModalContentArea(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
43
|
+
auto swiftClosure = NitroModal::Func_void_ModalContentArea::fromUnsafe(swiftClosureWrapper);
|
|
44
|
+
return [swiftClosure = std::move(swiftClosure)](const ModalContentArea& area) mutable -> void {
|
|
45
|
+
swiftClosure.call(area);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// pragma MARK: std::shared_ptr<HybridNitroModalSpec>
|
|
50
|
+
std::shared_ptr<HybridNitroModalSpec> create_std__shared_ptr_HybridNitroModalSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
51
|
+
NitroModal::HybridNitroModalSpec_cxx swiftPart = NitroModal::HybridNitroModalSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
52
|
+
return std::make_shared<margelo::nitro::nitromodal::HybridNitroModalSpecSwift>(swiftPart);
|
|
53
|
+
}
|
|
54
|
+
void* NON_NULL get_std__shared_ptr_HybridNitroModalSpec_(std__shared_ptr_HybridNitroModalSpec_ cppType) {
|
|
55
|
+
std::shared_ptr<margelo::nitro::nitromodal::HybridNitroModalSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::nitromodal::HybridNitroModalSpecSwift>(cppType);
|
|
56
|
+
#ifdef NITRO_DEBUG
|
|
57
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
58
|
+
throw std::runtime_error("Class \"HybridNitroModalSpec\" is not implemented in Swift!");
|
|
59
|
+
}
|
|
60
|
+
#endif
|
|
61
|
+
NitroModal::HybridNitroModalSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
62
|
+
return swiftPart.toUnsafe();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
} // namespace margelo::nitro::nitromodal::bridge::swift
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroModal-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 `DismissReason` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nitromodal { enum class DismissReason; }
|
|
13
|
+
// Forward declaration of `HybridNitroModalSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::nitromodal { class HybridNitroModalSpec; }
|
|
15
|
+
// Forward declaration of `ModalContentArea` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitromodal { struct ModalContentArea; }
|
|
17
|
+
// Forward declaration of `SheetDetent` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitromodal { enum class SheetDetent; }
|
|
19
|
+
|
|
20
|
+
// Forward declarations of Swift defined types
|
|
21
|
+
// Forward declaration of `HybridNitroModalSpec_cxx` to properly resolve imports.
|
|
22
|
+
namespace NitroModal { class HybridNitroModalSpec_cxx; }
|
|
23
|
+
|
|
24
|
+
// Include C++ defined types
|
|
25
|
+
#include "DismissReason.hpp"
|
|
26
|
+
#include "HybridNitroModalSpec.hpp"
|
|
27
|
+
#include "ModalContentArea.hpp"
|
|
28
|
+
#include "SheetDetent.hpp"
|
|
29
|
+
#include <NitroModules/Result.hpp>
|
|
30
|
+
#include <exception>
|
|
31
|
+
#include <functional>
|
|
32
|
+
#include <memory>
|
|
33
|
+
#include <optional>
|
|
34
|
+
#include <vector>
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
38
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
39
|
+
*/
|
|
40
|
+
namespace margelo::nitro::nitromodal::bridge::swift {
|
|
41
|
+
|
|
42
|
+
// pragma MARK: std::vector<SheetDetent>
|
|
43
|
+
/**
|
|
44
|
+
* Specialized version of `std::vector<SheetDetent>`.
|
|
45
|
+
*/
|
|
46
|
+
using std__vector_SheetDetent_ = std::vector<SheetDetent>;
|
|
47
|
+
inline std::vector<SheetDetent> create_std__vector_SheetDetent_(size_t size) noexcept {
|
|
48
|
+
std::vector<SheetDetent> vector;
|
|
49
|
+
vector.reserve(size);
|
|
50
|
+
return vector;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// pragma MARK: std::optional<double>
|
|
54
|
+
/**
|
|
55
|
+
* Specialized version of `std::optional<double>`.
|
|
56
|
+
*/
|
|
57
|
+
using std__optional_double_ = std::optional<double>;
|
|
58
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
59
|
+
return std::optional<double>(value);
|
|
60
|
+
}
|
|
61
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
62
|
+
return optional.has_value();
|
|
63
|
+
}
|
|
64
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
65
|
+
return optional.value();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// pragma MARK: std::function<void()>
|
|
69
|
+
/**
|
|
70
|
+
* Specialized version of `std::function<void()>`.
|
|
71
|
+
*/
|
|
72
|
+
using Func_void = std::function<void()>;
|
|
73
|
+
/**
|
|
74
|
+
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
75
|
+
*/
|
|
76
|
+
class Func_void_Wrapper final {
|
|
77
|
+
public:
|
|
78
|
+
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
79
|
+
inline void call() const noexcept {
|
|
80
|
+
_function->operator()();
|
|
81
|
+
}
|
|
82
|
+
private:
|
|
83
|
+
std::unique_ptr<std::function<void()>> _function;
|
|
84
|
+
} SWIFT_NONCOPYABLE;
|
|
85
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
86
|
+
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
87
|
+
return Func_void_Wrapper(std::move(value));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// pragma MARK: std::optional<std::function<void()>>
|
|
91
|
+
/**
|
|
92
|
+
* Specialized version of `std::optional<std::function<void()>>`.
|
|
93
|
+
*/
|
|
94
|
+
using std__optional_std__function_void____ = std::optional<std::function<void()>>;
|
|
95
|
+
inline std::optional<std::function<void()>> create_std__optional_std__function_void____(const std::function<void()>& value) noexcept {
|
|
96
|
+
return std::optional<std::function<void()>>(value);
|
|
97
|
+
}
|
|
98
|
+
inline bool has_value_std__optional_std__function_void____(const std::optional<std::function<void()>>& optional) noexcept {
|
|
99
|
+
return optional.has_value();
|
|
100
|
+
}
|
|
101
|
+
inline std::function<void()> get_std__optional_std__function_void____(const std::optional<std::function<void()>>& optional) noexcept {
|
|
102
|
+
return optional.value();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// pragma MARK: std::function<void(DismissReason /* reason */)>
|
|
106
|
+
/**
|
|
107
|
+
* Specialized version of `std::function<void(DismissReason)>`.
|
|
108
|
+
*/
|
|
109
|
+
using Func_void_DismissReason = std::function<void(DismissReason /* reason */)>;
|
|
110
|
+
/**
|
|
111
|
+
* Wrapper class for a `std::function<void(DismissReason / * reason * /)>`, this can be used from Swift.
|
|
112
|
+
*/
|
|
113
|
+
class Func_void_DismissReason_Wrapper final {
|
|
114
|
+
public:
|
|
115
|
+
explicit Func_void_DismissReason_Wrapper(std::function<void(DismissReason /* reason */)>&& func): _function(std::make_unique<std::function<void(DismissReason /* reason */)>>(std::move(func))) {}
|
|
116
|
+
inline void call(int reason) const noexcept {
|
|
117
|
+
_function->operator()(static_cast<DismissReason>(reason));
|
|
118
|
+
}
|
|
119
|
+
private:
|
|
120
|
+
std::unique_ptr<std::function<void(DismissReason /* reason */)>> _function;
|
|
121
|
+
} SWIFT_NONCOPYABLE;
|
|
122
|
+
Func_void_DismissReason create_Func_void_DismissReason(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
123
|
+
inline Func_void_DismissReason_Wrapper wrap_Func_void_DismissReason(Func_void_DismissReason value) noexcept {
|
|
124
|
+
return Func_void_DismissReason_Wrapper(std::move(value));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// pragma MARK: std::optional<std::function<void(DismissReason /* reason */)>>
|
|
128
|
+
/**
|
|
129
|
+
* Specialized version of `std::optional<std::function<void(DismissReason / * reason * /)>>`.
|
|
130
|
+
*/
|
|
131
|
+
using std__optional_std__function_void_DismissReason____reason______ = std::optional<std::function<void(DismissReason /* reason */)>>;
|
|
132
|
+
inline std::optional<std::function<void(DismissReason /* reason */)>> create_std__optional_std__function_void_DismissReason____reason______(const std::function<void(DismissReason /* reason */)>& value) noexcept {
|
|
133
|
+
return std::optional<std::function<void(DismissReason /* reason */)>>(value);
|
|
134
|
+
}
|
|
135
|
+
inline bool has_value_std__optional_std__function_void_DismissReason____reason______(const std::optional<std::function<void(DismissReason /* reason */)>>& optional) noexcept {
|
|
136
|
+
return optional.has_value();
|
|
137
|
+
}
|
|
138
|
+
inline std::function<void(DismissReason /* reason */)> get_std__optional_std__function_void_DismissReason____reason______(const std::optional<std::function<void(DismissReason /* reason */)>>& optional) noexcept {
|
|
139
|
+
return optional.value();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// pragma MARK: std::function<void(double /* index */)>
|
|
143
|
+
/**
|
|
144
|
+
* Specialized version of `std::function<void(double)>`.
|
|
145
|
+
*/
|
|
146
|
+
using Func_void_double = std::function<void(double /* index */)>;
|
|
147
|
+
/**
|
|
148
|
+
* Wrapper class for a `std::function<void(double / * index * /)>`, this can be used from Swift.
|
|
149
|
+
*/
|
|
150
|
+
class Func_void_double_Wrapper final {
|
|
151
|
+
public:
|
|
152
|
+
explicit Func_void_double_Wrapper(std::function<void(double /* index */)>&& func): _function(std::make_unique<std::function<void(double /* index */)>>(std::move(func))) {}
|
|
153
|
+
inline void call(double index) const noexcept {
|
|
154
|
+
_function->operator()(index);
|
|
155
|
+
}
|
|
156
|
+
private:
|
|
157
|
+
std::unique_ptr<std::function<void(double /* index */)>> _function;
|
|
158
|
+
} SWIFT_NONCOPYABLE;
|
|
159
|
+
Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
160
|
+
inline Func_void_double_Wrapper wrap_Func_void_double(Func_void_double value) noexcept {
|
|
161
|
+
return Func_void_double_Wrapper(std::move(value));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// pragma MARK: std::optional<std::function<void(double /* index */)>>
|
|
165
|
+
/**
|
|
166
|
+
* Specialized version of `std::optional<std::function<void(double / * index * /)>>`.
|
|
167
|
+
*/
|
|
168
|
+
using std__optional_std__function_void_double____index______ = std::optional<std::function<void(double /* index */)>>;
|
|
169
|
+
inline std::optional<std::function<void(double /* index */)>> create_std__optional_std__function_void_double____index______(const std::function<void(double /* index */)>& value) noexcept {
|
|
170
|
+
return std::optional<std::function<void(double /* index */)>>(value);
|
|
171
|
+
}
|
|
172
|
+
inline bool has_value_std__optional_std__function_void_double____index______(const std::optional<std::function<void(double /* index */)>>& optional) noexcept {
|
|
173
|
+
return optional.has_value();
|
|
174
|
+
}
|
|
175
|
+
inline std::function<void(double /* index */)> get_std__optional_std__function_void_double____index______(const std::optional<std::function<void(double /* index */)>>& optional) noexcept {
|
|
176
|
+
return optional.value();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// pragma MARK: std::function<void(const ModalContentArea& /* area */)>
|
|
180
|
+
/**
|
|
181
|
+
* Specialized version of `std::function<void(const ModalContentArea&)>`.
|
|
182
|
+
*/
|
|
183
|
+
using Func_void_ModalContentArea = std::function<void(const ModalContentArea& /* area */)>;
|
|
184
|
+
/**
|
|
185
|
+
* Wrapper class for a `std::function<void(const ModalContentArea& / * area * /)>`, this can be used from Swift.
|
|
186
|
+
*/
|
|
187
|
+
class Func_void_ModalContentArea_Wrapper final {
|
|
188
|
+
public:
|
|
189
|
+
explicit Func_void_ModalContentArea_Wrapper(std::function<void(const ModalContentArea& /* area */)>&& func): _function(std::make_unique<std::function<void(const ModalContentArea& /* area */)>>(std::move(func))) {}
|
|
190
|
+
inline void call(ModalContentArea area) const noexcept {
|
|
191
|
+
_function->operator()(area);
|
|
192
|
+
}
|
|
193
|
+
private:
|
|
194
|
+
std::unique_ptr<std::function<void(const ModalContentArea& /* area */)>> _function;
|
|
195
|
+
} SWIFT_NONCOPYABLE;
|
|
196
|
+
Func_void_ModalContentArea create_Func_void_ModalContentArea(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
197
|
+
inline Func_void_ModalContentArea_Wrapper wrap_Func_void_ModalContentArea(Func_void_ModalContentArea value) noexcept {
|
|
198
|
+
return Func_void_ModalContentArea_Wrapper(std::move(value));
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// pragma MARK: std::optional<std::function<void(const ModalContentArea& /* area */)>>
|
|
202
|
+
/**
|
|
203
|
+
* Specialized version of `std::optional<std::function<void(const ModalContentArea& / * area * /)>>`.
|
|
204
|
+
*/
|
|
205
|
+
using std__optional_std__function_void_const_ModalContentArea_____area______ = std::optional<std::function<void(const ModalContentArea& /* area */)>>;
|
|
206
|
+
inline std::optional<std::function<void(const ModalContentArea& /* area */)>> create_std__optional_std__function_void_const_ModalContentArea_____area______(const std::function<void(const ModalContentArea& /* area */)>& value) noexcept {
|
|
207
|
+
return std::optional<std::function<void(const ModalContentArea& /* area */)>>(value);
|
|
208
|
+
}
|
|
209
|
+
inline bool has_value_std__optional_std__function_void_const_ModalContentArea_____area______(const std::optional<std::function<void(const ModalContentArea& /* area */)>>& optional) noexcept {
|
|
210
|
+
return optional.has_value();
|
|
211
|
+
}
|
|
212
|
+
inline std::function<void(const ModalContentArea& /* area */)> get_std__optional_std__function_void_const_ModalContentArea_____area______(const std::optional<std::function<void(const ModalContentArea& /* area */)>>& optional) noexcept {
|
|
213
|
+
return optional.value();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// pragma MARK: std::shared_ptr<HybridNitroModalSpec>
|
|
217
|
+
/**
|
|
218
|
+
* Specialized version of `std::shared_ptr<HybridNitroModalSpec>`.
|
|
219
|
+
*/
|
|
220
|
+
using std__shared_ptr_HybridNitroModalSpec_ = std::shared_ptr<HybridNitroModalSpec>;
|
|
221
|
+
std::shared_ptr<HybridNitroModalSpec> create_std__shared_ptr_HybridNitroModalSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
222
|
+
void* NON_NULL get_std__shared_ptr_HybridNitroModalSpec_(std__shared_ptr_HybridNitroModalSpec_ cppType);
|
|
223
|
+
|
|
224
|
+
// pragma MARK: std::weak_ptr<HybridNitroModalSpec>
|
|
225
|
+
using std__weak_ptr_HybridNitroModalSpec_ = std::weak_ptr<HybridNitroModalSpec>;
|
|
226
|
+
inline std__weak_ptr_HybridNitroModalSpec_ weakify_std__shared_ptr_HybridNitroModalSpec_(const std::shared_ptr<HybridNitroModalSpec>& strong) noexcept { return strong; }
|
|
227
|
+
|
|
228
|
+
// pragma MARK: Result<void>
|
|
229
|
+
using Result_void_ = Result<void>;
|
|
230
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
231
|
+
return Result<void>::withValue();
|
|
232
|
+
}
|
|
233
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
234
|
+
return Result<void>::withError(error);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
} // namespace margelo::nitro::nitromodal::bridge::swift
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroModal-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 `DismissReason` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::nitromodal { enum class DismissReason; }
|
|
13
|
+
// Forward declaration of `HybridNitroModalSpec` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::nitromodal { class HybridNitroModalSpec; }
|
|
15
|
+
// Forward declaration of `KeyboardBehavior` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::nitromodal { enum class KeyboardBehavior; }
|
|
17
|
+
// Forward declaration of `ModalContentArea` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::nitromodal { struct ModalContentArea; }
|
|
19
|
+
// Forward declaration of `ModalMode` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::nitromodal { enum class ModalMode; }
|
|
21
|
+
// Forward declaration of `PopupAnimation` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitromodal { enum class PopupAnimation; }
|
|
23
|
+
// Forward declaration of `SheetDetent` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::nitromodal { enum class SheetDetent; }
|
|
25
|
+
|
|
26
|
+
// Include C++ defined types
|
|
27
|
+
#include "DismissReason.hpp"
|
|
28
|
+
#include "HybridNitroModalSpec.hpp"
|
|
29
|
+
#include "KeyboardBehavior.hpp"
|
|
30
|
+
#include "ModalContentArea.hpp"
|
|
31
|
+
#include "ModalMode.hpp"
|
|
32
|
+
#include "PopupAnimation.hpp"
|
|
33
|
+
#include "SheetDetent.hpp"
|
|
34
|
+
#include <NitroModules/Result.hpp>
|
|
35
|
+
#include <exception>
|
|
36
|
+
#include <functional>
|
|
37
|
+
#include <memory>
|
|
38
|
+
#include <optional>
|
|
39
|
+
#include <vector>
|
|
40
|
+
|
|
41
|
+
// C++ helpers for Swift
|
|
42
|
+
#include "NitroModal-Swift-Cxx-Bridge.hpp"
|
|
43
|
+
|
|
44
|
+
// Common C++ types used in Swift
|
|
45
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
46
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
47
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
48
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
49
|
+
|
|
50
|
+
// Forward declarations of Swift defined types
|
|
51
|
+
// Forward declaration of `HybridNitroModalSpec_cxx` to properly resolve imports.
|
|
52
|
+
namespace NitroModal { class HybridNitroModalSpec_cxx; }
|
|
53
|
+
|
|
54
|
+
// Include Swift defined types
|
|
55
|
+
#if __has_include("NitroModal-Swift.h")
|
|
56
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
57
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroModal".
|
|
58
|
+
#include "NitroModal-Swift.h"
|
|
59
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
60
|
+
#elif __has_include(<NitroModal/NitroModal-Swift.h>)
|
|
61
|
+
#include <NitroModal/NitroModal-Swift.h>
|
|
62
|
+
#else
|
|
63
|
+
#error NitroModal's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroModal", and try building the app first.
|
|
64
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroModalAutolinking.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 "NitroModal-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridNitroModalSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface NitroModalAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation NitroModalAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::nitromodal;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"NitroModal",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridNitroModalSpec> hybridObject = NitroModal::NitroModalAutolinking::createNitroModal();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|