@imagowave/vision-ocr 0.0.2 → 0.0.3
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/{NitroVisionOcr.podspec → VisionOCR.podspec} +2 -2
- package/nitro.json +3 -3
- package/nitrogen/generated/android/{NitroVisionOcr+autolinking.cmake → VisionOCR+autolinking.cmake} +9 -9
- package/nitrogen/generated/android/{NitroVisionOcr+autolinking.gradle → VisionOCR+autolinking.gradle} +3 -3
- package/nitrogen/generated/android/{NitroVisionOcrOnLoad.cpp → VisionOCROnLoad.cpp} +11 -12
- package/nitrogen/generated/android/{NitroVisionOcrOnLoad.hpp → VisionOCROnLoad.hpp} +3 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/{NitroVisionOcrOnLoad.kt → VisionOCROnLoad.kt} +8 -8
- package/nitrogen/generated/ios/{NitroVisionOcr+autolinking.rb → VisionOCR+autolinking.rb} +4 -4
- package/nitrogen/generated/ios/{NitroVisionOcr-Swift-Cxx-Bridge.cpp → VisionOCR-Swift-Cxx-Bridge.cpp} +5 -5
- package/nitrogen/generated/ios/{NitroVisionOcr-Swift-Cxx-Bridge.hpp → VisionOCR-Swift-Cxx-Bridge.hpp} +2 -2
- package/nitrogen/generated/ios/{NitroVisionOcr-Swift-Cxx-Umbrella.hpp → VisionOCR-Swift-Cxx-Umbrella.hpp} +9 -9
- package/nitrogen/generated/ios/{NitroVisionOcrAutolinking.mm → VisionOCRAutolinking.mm} +7 -7
- package/nitrogen/generated/ios/{NitroVisionOcrAutolinking.swift → VisionOCRAutolinking.swift} +5 -5
- package/nitrogen/generated/ios/c++/HybridVisionOCRSpecSwift.hpp +5 -5
- package/nitrogen/generated/ios/swift/HybridVisionOCRSpec_cxx.swift +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
|
@@ -3,7 +3,7 @@ require "json"
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
4
|
|
|
5
5
|
Pod::Spec.new do |s|
|
|
6
|
-
s.name = "
|
|
6
|
+
s.name = "VisionOCR"
|
|
7
7
|
s.version = package["version"]
|
|
8
8
|
s.summary = package["description"]
|
|
9
9
|
s.homepage = package["homepage"]
|
|
@@ -22,7 +22,7 @@ Pod::Spec.new do |s|
|
|
|
22
22
|
"cpp/**/*.{hpp,cpp}",
|
|
23
23
|
]
|
|
24
24
|
|
|
25
|
-
load 'nitrogen/generated/ios/
|
|
25
|
+
load 'nitrogen/generated/ios/VisionOCR+autolinking.rb'
|
|
26
26
|
add_nitrogen_files(s)
|
|
27
27
|
|
|
28
28
|
s.dependency 'React-jsi'
|
package/nitro.json
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"$schema": "https://nitro.margelo.com/nitro.schema.json",
|
|
3
3
|
"cxxNamespace": ["visionocr"],
|
|
4
4
|
"ios": {
|
|
5
|
-
"iosModuleName": "
|
|
5
|
+
"iosModuleName": "VisionOCR"
|
|
6
6
|
},
|
|
7
7
|
"android": {
|
|
8
8
|
"androidNamespace": ["visionocr"],
|
|
9
|
-
"androidCxxLibName": "
|
|
9
|
+
"androidCxxLibName": "VisionOCR"
|
|
10
10
|
},
|
|
11
11
|
"autolinking": {
|
|
12
|
-
"
|
|
12
|
+
"VisionOCR": {
|
|
13
13
|
"ios": {
|
|
14
14
|
"language": "swift",
|
|
15
15
|
"implementationClassName": "HybridVisionOCR"
|
package/nitrogen/generated/android/{NitroVisionOcr+autolinking.cmake → VisionOCR+autolinking.cmake}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
#
|
|
2
|
+
# VisionOCR+autolinking.cmake
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
5
|
# Copyright © Marc Rousavy @ Margelo
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
#
|
|
11
11
|
# To use it, add this to your CMakeLists.txt:
|
|
12
12
|
# ```cmake
|
|
13
|
-
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/
|
|
13
|
+
# include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/VisionOCR+autolinking.cmake)
|
|
14
14
|
# ```
|
|
15
15
|
|
|
16
16
|
# Define a flag to check if we are building properly
|
|
17
|
-
add_definitions(-
|
|
17
|
+
add_definitions(-DBUILDING_VISIONOCR_WITH_GENERATED_CMAKE_PROJECT)
|
|
18
18
|
|
|
19
19
|
# Enable Raw Props parsing in react-native (for Nitro Views)
|
|
20
20
|
add_definitions(-DRN_SERIALIZABLE_STATE)
|
|
@@ -29,9 +29,9 @@ include_directories(
|
|
|
29
29
|
# Add all .cpp sources that were generated by Nitrogen
|
|
30
30
|
target_sources(
|
|
31
31
|
# CMake project name (Android C++ library name)
|
|
32
|
-
|
|
32
|
+
VisionOCR PRIVATE
|
|
33
33
|
# Autolinking Setup
|
|
34
|
-
../nitrogen/generated/android/
|
|
34
|
+
../nitrogen/generated/android/VisionOCROnLoad.cpp
|
|
35
35
|
# Shared Nitrogen C++ sources
|
|
36
36
|
../nitrogen/generated/shared/c++/HybridVisionOCRSpec.cpp
|
|
37
37
|
# Android-specific Nitrogen C++ sources
|
|
@@ -41,7 +41,7 @@ target_sources(
|
|
|
41
41
|
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
42
42
|
# Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
|
|
43
43
|
target_compile_definitions(
|
|
44
|
-
|
|
44
|
+
VisionOCR PRIVATE
|
|
45
45
|
-DFOLLY_NO_CONFIG=1
|
|
46
46
|
-DFOLLY_HAVE_CLOCK_GETTIME=1
|
|
47
47
|
-DFOLLY_USE_LIBCPP=1
|
|
@@ -61,7 +61,7 @@ find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all Hybri
|
|
|
61
61
|
|
|
62
62
|
# Link all libraries together
|
|
63
63
|
target_link_libraries(
|
|
64
|
-
|
|
64
|
+
VisionOCR
|
|
65
65
|
fbjni::fbjni # <-- Facebook C++ JNI helpers
|
|
66
66
|
ReactAndroid::jsi # <-- RN: JSI
|
|
67
67
|
react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
|
|
@@ -70,12 +70,12 @@ target_link_libraries(
|
|
|
70
70
|
# Link react-native (different prefab between RN 0.75 and RN 0.76)
|
|
71
71
|
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
|
|
72
72
|
target_link_libraries(
|
|
73
|
-
|
|
73
|
+
VisionOCR
|
|
74
74
|
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
|
|
75
75
|
)
|
|
76
76
|
else()
|
|
77
77
|
target_link_libraries(
|
|
78
|
-
|
|
78
|
+
VisionOCR
|
|
79
79
|
ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
|
|
80
80
|
)
|
|
81
81
|
endif()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// VisionOCR+autolinking.gradle
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
///
|
|
11
11
|
/// To use it, add this to your build.gradle:
|
|
12
12
|
/// ```gradle
|
|
13
|
-
/// apply from: '../nitrogen/generated/android/
|
|
13
|
+
/// apply from: '../nitrogen/generated/android/VisionOCR+autolinking.gradle'
|
|
14
14
|
/// ```
|
|
15
15
|
|
|
16
|
-
logger.warn("[NitroModules] 🔥
|
|
16
|
+
logger.warn("[NitroModules] 🔥 VisionOCR is boosted by nitro!")
|
|
17
17
|
|
|
18
18
|
android {
|
|
19
19
|
sourceSets {
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// VisionOCROnLoad.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
#ifndef
|
|
9
|
-
#error
|
|
8
|
+
#ifndef BUILDING_VISIONOCR_WITH_GENERATED_CMAKE_PROJECT
|
|
9
|
+
#error VisionOCROnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
|
|
10
10
|
#endif
|
|
11
11
|
|
|
12
|
-
#include "
|
|
12
|
+
#include "VisionOCROnLoad.hpp"
|
|
13
13
|
|
|
14
14
|
#include <jni.h>
|
|
15
15
|
#include <fbjni/fbjni.h>
|
|
16
16
|
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
17
|
|
|
18
18
|
#include "JHybridVisionOCRSpec.hpp"
|
|
19
|
-
#include "JHybridNitroVisionOcrSpec.hpp"
|
|
20
19
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
21
20
|
|
|
22
21
|
namespace margelo::nitro::visionocr {
|
|
@@ -27,12 +26,12 @@ int initialize(JavaVM* vm) {
|
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
struct
|
|
29
|
+
struct JHybridVisionOCRSpecImpl: public jni::JavaClass<JHybridVisionOCRSpecImpl, JHybridVisionOCRSpec::JavaPart> {
|
|
31
30
|
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visionocr/HybridVisionOCR;";
|
|
32
|
-
static std::shared_ptr<
|
|
33
|
-
static const auto constructorFn = javaClassStatic()->getConstructor<
|
|
34
|
-
jni::local_ref<
|
|
35
|
-
return javaPart->
|
|
31
|
+
static std::shared_ptr<JHybridVisionOCRSpec> create() {
|
|
32
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridVisionOCRSpecImpl::javaobject()>();
|
|
33
|
+
jni::local_ref<JHybridVisionOCRSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
34
|
+
return javaPart->getJHybridVisionOCRSpec();
|
|
36
35
|
}
|
|
37
36
|
};
|
|
38
37
|
|
|
@@ -45,9 +44,9 @@ void registerAllNatives() {
|
|
|
45
44
|
|
|
46
45
|
// Register Nitro Hybrid Objects
|
|
47
46
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
48
|
-
"
|
|
47
|
+
"VisionOCR",
|
|
49
48
|
[]() -> std::shared_ptr<HybridObject> {
|
|
50
|
-
return
|
|
49
|
+
return JHybridVisionOCRSpecImpl::create();
|
|
51
50
|
}
|
|
52
51
|
);
|
|
53
52
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// VisionOCROnLoad.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
@@ -15,14 +15,14 @@ namespace margelo::nitro::visionocr {
|
|
|
15
15
|
int initialize(JavaVM* vm);
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* Register the native (C++) part of
|
|
18
|
+
* Register the native (C++) part of VisionOCR, and autolinks all Hybrid Objects.
|
|
19
19
|
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
|
|
20
20
|
* inside a `facebook::jni::initialize(vm, ...)` call.
|
|
21
21
|
* Example:
|
|
22
22
|
* ```cpp (cpp-adapter.cpp)
|
|
23
23
|
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
24
24
|
* return facebook::jni::initialize(vm, []() {
|
|
25
|
-
* // register all
|
|
25
|
+
* // register all VisionOCR HybridObjects
|
|
26
26
|
* margelo::nitro::visionocr::registerNatives();
|
|
27
27
|
* // any other custom registrations go here.
|
|
28
28
|
* });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// VisionOCROnLoad.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
@@ -9,24 +9,24 @@ package com.margelo.nitro.visionocr
|
|
|
9
9
|
|
|
10
10
|
import android.util.Log
|
|
11
11
|
|
|
12
|
-
internal class
|
|
12
|
+
internal class VisionOCROnLoad {
|
|
13
13
|
companion object {
|
|
14
|
-
private const val TAG = "
|
|
14
|
+
private const val TAG = "VisionOCROnLoad"
|
|
15
15
|
private var didLoad = false
|
|
16
16
|
/**
|
|
17
|
-
* Initializes the native part of "
|
|
17
|
+
* Initializes the native part of "VisionOCR".
|
|
18
18
|
* This method is idempotent and can be called more than once.
|
|
19
19
|
*/
|
|
20
20
|
@JvmStatic
|
|
21
21
|
fun initializeNative() {
|
|
22
22
|
if (didLoad) return
|
|
23
23
|
try {
|
|
24
|
-
Log.i(TAG, "Loading
|
|
25
|
-
System.loadLibrary("
|
|
26
|
-
Log.i(TAG, "Successfully loaded
|
|
24
|
+
Log.i(TAG, "Loading VisionOCR C++ library...")
|
|
25
|
+
System.loadLibrary("VisionOCR")
|
|
26
|
+
Log.i(TAG, "Successfully loaded VisionOCR C++ library!")
|
|
27
27
|
didLoad = true
|
|
28
28
|
} catch (e: Error) {
|
|
29
|
-
Log.e(TAG, "Failed to load
|
|
29
|
+
Log.e(TAG, "Failed to load VisionOCR C++ library! Is it properly installed and linked? " +
|
|
30
30
|
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
31
|
throw e
|
|
32
32
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
#
|
|
2
|
+
# VisionOCR+autolinking.rb
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
5
|
# Copyright © Marc Rousavy @ Margelo
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
# # ...
|
|
15
15
|
#
|
|
16
16
|
# # Add all files generated by Nitrogen
|
|
17
|
-
# load 'nitrogen/generated/ios/
|
|
17
|
+
# load 'nitrogen/generated/ios/VisionOCR+autolinking.rb'
|
|
18
18
|
# add_nitrogen_files(spec)
|
|
19
19
|
# end
|
|
20
20
|
# ```
|
|
21
21
|
|
|
22
22
|
def add_nitrogen_files(spec)
|
|
23
|
-
Pod::UI.puts "[NitroModules] 🔥
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 VisionOCR is boosted by nitro!"
|
|
24
24
|
|
|
25
25
|
spec.dependency "NitroModules"
|
|
26
26
|
|
|
@@ -37,7 +37,7 @@ def add_nitrogen_files(spec)
|
|
|
37
37
|
# Generated specs
|
|
38
38
|
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
39
|
# Swift to C++ bridging helpers
|
|
40
|
-
"nitrogen/generated/ios/
|
|
40
|
+
"nitrogen/generated/ios/VisionOCR-Swift-Cxx-Bridge.hpp"
|
|
41
41
|
]
|
|
42
42
|
|
|
43
43
|
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// VisionOCR-Swift-Cxx-Bridge.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
#include "
|
|
8
|
+
#include "VisionOCR-Swift-Cxx-Bridge.hpp"
|
|
9
9
|
|
|
10
10
|
// Include C++ implementation defined types
|
|
11
11
|
#include "HybridVisionOCRSpecSwift.hpp"
|
|
12
|
-
#include "
|
|
12
|
+
#include "VisionOCR-Swift-Cxx-Umbrella.hpp"
|
|
13
13
|
#include <NitroModules/NitroDefines.hpp>
|
|
14
14
|
#include <VisionCamera/VisionCamera-Swift-Cxx-Bridge.hpp>
|
|
15
15
|
|
|
@@ -27,7 +27,7 @@ namespace margelo::nitro::visionocr::bridge::swift {
|
|
|
27
27
|
|
|
28
28
|
// pragma MARK: std::shared_ptr<HybridVisionOCRSpec>
|
|
29
29
|
std::shared_ptr<HybridVisionOCRSpec> create_std__shared_ptr_HybridVisionOCRSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
30
|
-
|
|
30
|
+
VisionOCR::HybridVisionOCRSpec_cxx swiftPart = VisionOCR::HybridVisionOCRSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
31
31
|
return std::make_shared<margelo::nitro::visionocr::HybridVisionOCRSpecSwift>(swiftPart);
|
|
32
32
|
}
|
|
33
33
|
void* NON_NULL get_std__shared_ptr_HybridVisionOCRSpec_(std__shared_ptr_HybridVisionOCRSpec_ cppType) {
|
|
@@ -37,7 +37,7 @@ namespace margelo::nitro::visionocr::bridge::swift {
|
|
|
37
37
|
throw std::runtime_error("Class \"HybridVisionOCRSpec\" is not implemented in Swift!");
|
|
38
38
|
}
|
|
39
39
|
#endif
|
|
40
|
-
|
|
40
|
+
VisionOCR::HybridVisionOCRSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
41
41
|
return swiftPart.toUnsafe();
|
|
42
42
|
}
|
|
43
43
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// VisionOCR-Swift-Cxx-Bridge.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
@@ -31,7 +31,7 @@ namespace margelo::nitro::visionocr { enum class RLevel; }
|
|
|
31
31
|
// Forward declaration of `HybridFrameSpec_cxx` to properly resolve imports.
|
|
32
32
|
namespace VisionCamera { class HybridFrameSpec_cxx; }
|
|
33
33
|
// Forward declaration of `HybridVisionOCRSpec_cxx` to properly resolve imports.
|
|
34
|
-
namespace
|
|
34
|
+
namespace VisionOCR { class HybridVisionOCRSpec_cxx; }
|
|
35
35
|
|
|
36
36
|
// Include C++ defined types
|
|
37
37
|
#include "HybridVisionOCRSpec.hpp"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// VisionOCR-Swift-Cxx-Umbrella.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
@@ -45,7 +45,7 @@ namespace margelo::nitro::visionocr { enum class RLevel; }
|
|
|
45
45
|
#include <vector>
|
|
46
46
|
|
|
47
47
|
// C++ helpers for Swift
|
|
48
|
-
#include "
|
|
48
|
+
#include "VisionOCR-Swift-Cxx-Bridge.hpp"
|
|
49
49
|
|
|
50
50
|
// Common C++ types used in Swift
|
|
51
51
|
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
@@ -57,16 +57,16 @@ namespace margelo::nitro::visionocr { enum class RLevel; }
|
|
|
57
57
|
// Forward declaration of `HybridFrameSpec_cxx` to properly resolve imports.
|
|
58
58
|
namespace VisionCamera { class HybridFrameSpec_cxx; }
|
|
59
59
|
// Forward declaration of `HybridVisionOCRSpec_cxx` to properly resolve imports.
|
|
60
|
-
namespace
|
|
60
|
+
namespace VisionOCR { class HybridVisionOCRSpec_cxx; }
|
|
61
61
|
|
|
62
62
|
// Include Swift defined types
|
|
63
|
-
#if __has_include("
|
|
63
|
+
#if __has_include("VisionOCR-Swift.h")
|
|
64
64
|
// This header is generated by Xcode/Swift on every app build.
|
|
65
|
-
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "
|
|
66
|
-
#include "
|
|
65
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "VisionOCR".
|
|
66
|
+
#include "VisionOCR-Swift.h"
|
|
67
67
|
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
68
|
-
#elif __has_include(<
|
|
69
|
-
#include <
|
|
68
|
+
#elif __has_include(<VisionOCR/VisionOCR-Swift.h>)
|
|
69
|
+
#include <VisionOCR/VisionOCR-Swift.h>
|
|
70
70
|
#else
|
|
71
|
-
#error
|
|
71
|
+
#error VisionOCR's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "VisionOCR", and try building the app first.
|
|
72
72
|
#endif
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// VisionOCRAutolinking.mm
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
@@ -7,24 +7,24 @@
|
|
|
7
7
|
|
|
8
8
|
#import <Foundation/Foundation.h>
|
|
9
9
|
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
-
#import "
|
|
10
|
+
#import "VisionOCR-Swift-Cxx-Umbrella.hpp"
|
|
11
11
|
#import <type_traits>
|
|
12
12
|
|
|
13
|
-
#include "
|
|
13
|
+
#include "HybridVisionOCRSpecSwift.hpp"
|
|
14
14
|
|
|
15
|
-
@interface
|
|
15
|
+
@interface VisionOCRAutolinking : NSObject
|
|
16
16
|
@end
|
|
17
17
|
|
|
18
|
-
@implementation
|
|
18
|
+
@implementation VisionOCRAutolinking
|
|
19
19
|
|
|
20
20
|
+ (void) load {
|
|
21
21
|
using namespace margelo::nitro;
|
|
22
22
|
using namespace margelo::nitro::visionocr;
|
|
23
23
|
|
|
24
24
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
-
"
|
|
25
|
+
"VisionOCR",
|
|
26
26
|
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
-
std::shared_ptr<
|
|
27
|
+
std::shared_ptr<HybridVisionOCRSpec> hybridObject = VisionOCR::VisionOCRAutolinking::createVisionOCR();
|
|
28
28
|
return hybridObject;
|
|
29
29
|
}
|
|
30
30
|
);
|
package/nitrogen/generated/ios/{NitroVisionOcrAutolinking.swift → VisionOCRAutolinking.swift}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// VisionOCRAutolinking.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
@@ -9,18 +9,18 @@ import NitroModules
|
|
|
9
9
|
|
|
10
10
|
// TODO: Use empty enums once Swift supports exporting them as namespaces
|
|
11
11
|
// See: https://github.com/swiftlang/swift/pull/83616
|
|
12
|
-
public final class
|
|
12
|
+
public final class VisionOCRAutolinking {
|
|
13
13
|
public typealias bridge = margelo.nitro.visionocr.bridge.swift
|
|
14
14
|
|
|
15
|
-
public static func
|
|
15
|
+
public static func createVisionOCR() -> bridge.std__shared_ptr_HybridVisionOCRSpec_ {
|
|
16
16
|
let hybridObject = HybridVisionOCR()
|
|
17
|
-
return { () -> bridge.
|
|
17
|
+
return { () -> bridge.std__shared_ptr_HybridVisionOCRSpec_ in
|
|
18
18
|
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
19
19
|
return __cxxWrapped.getCxxPart()
|
|
20
20
|
}()
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
public static func
|
|
23
|
+
public static func isVisionOCRRecyclable() -> Bool {
|
|
24
24
|
return HybridVisionOCR.self is any RecyclableView.Type
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#include "HybridVisionOCRSpec.hpp"
|
|
11
11
|
|
|
12
12
|
// Forward declaration of `HybridVisionOCRSpec_cxx` to properly resolve imports.
|
|
13
|
-
namespace
|
|
13
|
+
namespace VisionOCR { class HybridVisionOCRSpec_cxx; }
|
|
14
14
|
|
|
15
15
|
// Forward declaration of `OcrResult` to properly resolve imports.
|
|
16
16
|
namespace margelo::nitro::visionocr { struct OcrResult; }
|
|
@@ -42,7 +42,7 @@ namespace margelo::nitro::visionocr { enum class RLevel; }
|
|
|
42
42
|
#include "OcrOptions.hpp"
|
|
43
43
|
#include "RLevel.hpp"
|
|
44
44
|
|
|
45
|
-
#include "
|
|
45
|
+
#include "VisionOCR-Swift-Cxx-Umbrella.hpp"
|
|
46
46
|
|
|
47
47
|
namespace margelo::nitro::visionocr {
|
|
48
48
|
|
|
@@ -59,13 +59,13 @@ namespace margelo::nitro::visionocr {
|
|
|
59
59
|
class HybridVisionOCRSpecSwift: public virtual HybridVisionOCRSpec {
|
|
60
60
|
public:
|
|
61
61
|
// Constructor from a Swift instance
|
|
62
|
-
explicit HybridVisionOCRSpecSwift(const
|
|
62
|
+
explicit HybridVisionOCRSpecSwift(const VisionOCR::HybridVisionOCRSpec_cxx& swiftPart):
|
|
63
63
|
HybridObject(HybridVisionOCRSpec::TAG),
|
|
64
64
|
_swiftPart(swiftPart) { }
|
|
65
65
|
|
|
66
66
|
public:
|
|
67
67
|
// Get the Swift part
|
|
68
|
-
inline
|
|
68
|
+
inline VisionOCR::HybridVisionOCRSpec_cxx& getSwiftPart() noexcept {
|
|
69
69
|
return _swiftPart;
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -102,7 +102,7 @@ namespace margelo::nitro::visionocr {
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
private:
|
|
105
|
-
|
|
105
|
+
VisionOCR::HybridVisionOCRSpec_cxx _swiftPart;
|
|
106
106
|
};
|
|
107
107
|
|
|
108
108
|
} // namespace margelo::nitro::visionocr
|
|
@@ -20,7 +20,7 @@ import VisionCamera
|
|
|
20
20
|
open class HybridVisionOCRSpec_cxx {
|
|
21
21
|
/**
|
|
22
22
|
* The Swift <> C++ bridge's namespace (`margelo::nitro::visionocr::bridge::swift`)
|
|
23
|
-
* from `
|
|
23
|
+
* from `VisionOCR-Swift-Cxx-Bridge.hpp`.
|
|
24
24
|
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
25
25
|
*/
|
|
26
26
|
public typealias bridge = margelo.nitro.visionocr.bridge.swift
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { OcrOptions, OcrResult } from "./types";
|
|
|
6
6
|
|
|
7
7
|
export * from "./types";
|
|
8
8
|
|
|
9
|
-
const plugin = NitroModules.createHybridObject<VisionOCR>("
|
|
9
|
+
const plugin = NitroModules.createHybridObject<VisionOCR>("VisionOCR");
|
|
10
10
|
|
|
11
11
|
export default plugin;
|
|
12
12
|
|