@onekeyfe/react-native-cloud-kit-module 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/CloudKitModule.podspec +29 -0
  2. package/LICENSE +20 -0
  3. package/README.md +39 -0
  4. package/android/CMakeLists.txt +24 -0
  5. package/android/build.gradle +128 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +2 -0
  8. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  9. package/android/src/main/java/com/margelo/nitro/cloudkitmodule/CloudKitModule.kt +51 -0
  10. package/android/src/main/java/com/margelo/nitro/cloudkitmodule/CloudKitModulePackage.kt +22 -0
  11. package/ios/CloudKitModule.swift +186 -0
  12. package/ios/CloudKitModuleCore.swift +195 -0
  13. package/lib/module/CloudKitModule.nitro.js +4 -0
  14. package/lib/module/CloudKitModule.nitro.js.map +1 -0
  15. package/lib/module/index.js +6 -0
  16. package/lib/module/index.js.map +1 -0
  17. package/lib/module/package.json +1 -0
  18. package/lib/typescript/package.json +1 -0
  19. package/lib/typescript/src/CloudKitModule.nitro.d.ts +55 -0
  20. package/lib/typescript/src/CloudKitModule.nitro.d.ts.map +1 -0
  21. package/lib/typescript/src/index.d.ts +4 -0
  22. package/lib/typescript/src/index.d.ts.map +1 -0
  23. package/nitro.json +17 -0
  24. package/nitrogen/generated/android/c++/JAccountInfoResult.hpp +62 -0
  25. package/nitrogen/generated/android/c++/JDeleteRecordParams.hpp +57 -0
  26. package/nitrogen/generated/android/c++/JFetchRecordParams.hpp +57 -0
  27. package/nitrogen/generated/android/c++/JHybridCloudKitModuleSpec.cpp +192 -0
  28. package/nitrogen/generated/android/c++/JHybridCloudKitModuleSpec.hpp +70 -0
  29. package/nitrogen/generated/android/c++/JQueryRecordsParams.hpp +53 -0
  30. package/nitrogen/generated/android/c++/JQueryRecordsResult.hpp +73 -0
  31. package/nitrogen/generated/android/c++/JRecordExistsParams.hpp +57 -0
  32. package/nitrogen/generated/android/c++/JRecordResult.hpp +73 -0
  33. package/nitrogen/generated/android/c++/JSaveRecordParams.hpp +65 -0
  34. package/nitrogen/generated/android/c++/JSaveRecordResult.hpp +57 -0
  35. package/nitrogen/generated/android/cloudkitmodule+autolinking.cmake +81 -0
  36. package/nitrogen/generated/android/cloudkitmodule+autolinking.gradle +27 -0
  37. package/nitrogen/generated/android/cloudkitmoduleOnLoad.cpp +44 -0
  38. package/nitrogen/generated/android/cloudkitmoduleOnLoad.hpp +25 -0
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/AccountInfoResult.kt +35 -0
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/DeleteRecordParams.kt +32 -0
  41. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/FetchRecordParams.kt +32 -0
  42. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/HybridCloudKitModuleSpec.kt +76 -0
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/QueryRecordsParams.kt +29 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/QueryRecordsResult.kt +29 -0
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/RecordExistsParams.kt +32 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/RecordResult.kt +44 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/SaveRecordParams.kt +38 -0
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/SaveRecordResult.kt +32 -0
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cloudkitmodule/cloudkitmoduleOnLoad.kt +35 -0
  50. package/nitrogen/generated/ios/CloudKitModule+autolinking.rb +60 -0
  51. package/nitrogen/generated/ios/CloudKitModule-Swift-Cxx-Bridge.cpp +80 -0
  52. package/nitrogen/generated/ios/CloudKitModule-Swift-Cxx-Bridge.hpp +340 -0
  53. package/nitrogen/generated/ios/CloudKitModule-Swift-Cxx-Umbrella.hpp +74 -0
  54. package/nitrogen/generated/ios/CloudKitModuleAutolinking.mm +33 -0
  55. package/nitrogen/generated/ios/CloudKitModuleAutolinking.swift +25 -0
  56. package/nitrogen/generated/ios/c++/HybridCloudKitModuleSpecSwift.cpp +11 -0
  57. package/nitrogen/generated/ios/c++/HybridCloudKitModuleSpecSwift.hpp +150 -0
  58. package/nitrogen/generated/ios/swift/AccountInfoResult.swift +76 -0
  59. package/nitrogen/generated/ios/swift/DeleteRecordParams.swift +46 -0
  60. package/nitrogen/generated/ios/swift/FetchRecordParams.swift +46 -0
  61. package/nitrogen/generated/ios/swift/Func_void_AccountInfoResult.swift +47 -0
  62. package/nitrogen/generated/ios/swift/Func_void_QueryRecordsResult.swift +47 -0
  63. package/nitrogen/generated/ios/swift/Func_void_SaveRecordResult.swift +47 -0
  64. package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
  65. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  66. package/nitrogen/generated/ios/swift/Func_void_std__optional_RecordResult_.swift +47 -0
  67. package/nitrogen/generated/ios/swift/HybridCloudKitModuleSpec.swift +55 -0
  68. package/nitrogen/generated/ios/swift/HybridCloudKitModuleSpec_cxx.swift +250 -0
  69. package/nitrogen/generated/ios/swift/QueryRecordsParams.swift +35 -0
  70. package/nitrogen/generated/ios/swift/QueryRecordsResult.swift +43 -0
  71. package/nitrogen/generated/ios/swift/RecordExistsParams.swift +46 -0
  72. package/nitrogen/generated/ios/swift/RecordResult.swift +90 -0
  73. package/nitrogen/generated/ios/swift/SaveRecordParams.swift +68 -0
  74. package/nitrogen/generated/ios/swift/SaveRecordResult.swift +46 -0
  75. package/nitrogen/generated/shared/c++/AccountInfoResult.hpp +76 -0
  76. package/nitrogen/generated/shared/c++/DeleteRecordParams.hpp +71 -0
  77. package/nitrogen/generated/shared/c++/FetchRecordParams.hpp +71 -0
  78. package/nitrogen/generated/shared/c++/HybridCloudKitModuleSpec.cpp +27 -0
  79. package/nitrogen/generated/shared/c++/HybridCloudKitModuleSpec.hpp +95 -0
  80. package/nitrogen/generated/shared/c++/QueryRecordsParams.hpp +67 -0
  81. package/nitrogen/generated/shared/c++/QueryRecordsResult.hpp +69 -0
  82. package/nitrogen/generated/shared/c++/RecordExistsParams.hpp +71 -0
  83. package/nitrogen/generated/shared/c++/RecordResult.hpp +87 -0
  84. package/nitrogen/generated/shared/c++/SaveRecordParams.hpp +79 -0
  85. package/nitrogen/generated/shared/c++/SaveRecordResult.hpp +71 -0
  86. package/package.json +174 -0
  87. package/src/CloudKitModule.nitro.ts +64 -0
  88. package/src/index.tsx +8 -0
@@ -0,0 +1,32 @@
1
+ ///
2
+ /// DeleteRecordParams.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.cloudkitmodule
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "DeleteRecordParams".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class DeleteRecordParams
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val recordType: String,
27
+ @DoNotStrip
28
+ @Keep
29
+ val recordID: String
30
+ ) {
31
+ /* main constructor */
32
+ }
@@ -0,0 +1,32 @@
1
+ ///
2
+ /// FetchRecordParams.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.cloudkitmodule
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "FetchRecordParams".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class FetchRecordParams
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val recordType: String,
27
+ @DoNotStrip
28
+ @Keep
29
+ val recordID: String
30
+ ) {
31
+ /* main constructor */
32
+ }
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// HybridCloudKitModuleSpec.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.cloudkitmodule
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.*
14
+
15
+ /**
16
+ * A Kotlin class representing the CloudKitModule HybridObject.
17
+ * Implement this abstract class to create Kotlin-based instances of CloudKitModule.
18
+ */
19
+ @DoNotStrip
20
+ @Keep
21
+ @Suppress(
22
+ "KotlinJniMissingFunction", "unused",
23
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
24
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
25
+ )
26
+ abstract class HybridCloudKitModuleSpec: HybridObject() {
27
+ @DoNotStrip
28
+ private var mHybridData: HybridData = initHybrid()
29
+
30
+ init {
31
+ super.updateNative(mHybridData)
32
+ }
33
+
34
+ override fun updateNative(hybridData: HybridData) {
35
+ mHybridData = hybridData
36
+ super.updateNative(hybridData)
37
+ }
38
+
39
+ // Properties
40
+
41
+
42
+ // Methods
43
+ @DoNotStrip
44
+ @Keep
45
+ abstract fun isAvailable(): Promise<Boolean>
46
+
47
+ @DoNotStrip
48
+ @Keep
49
+ abstract fun getAccountInfo(): Promise<AccountInfoResult>
50
+
51
+ @DoNotStrip
52
+ @Keep
53
+ abstract fun saveRecord(params: SaveRecordParams): Promise<SaveRecordResult>
54
+
55
+ @DoNotStrip
56
+ @Keep
57
+ abstract fun fetchRecord(params: FetchRecordParams): Promise<RecordResult?>
58
+
59
+ @DoNotStrip
60
+ @Keep
61
+ abstract fun deleteRecord(params: DeleteRecordParams): Promise<Boolean>
62
+
63
+ @DoNotStrip
64
+ @Keep
65
+ abstract fun recordExists(params: RecordExistsParams): Promise<Boolean>
66
+
67
+ @DoNotStrip
68
+ @Keep
69
+ abstract fun queryRecords(params: QueryRecordsParams): Promise<QueryRecordsResult>
70
+
71
+ private external fun initHybrid(): HybridData
72
+
73
+ companion object {
74
+ private const val TAG = "HybridCloudKitModuleSpec"
75
+ }
76
+ }
@@ -0,0 +1,29 @@
1
+ ///
2
+ /// QueryRecordsParams.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.cloudkitmodule
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "QueryRecordsParams".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class QueryRecordsParams
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val recordType: String
27
+ ) {
28
+ /* main constructor */
29
+ }
@@ -0,0 +1,29 @@
1
+ ///
2
+ /// QueryRecordsResult.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.cloudkitmodule
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "QueryRecordsResult".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class QueryRecordsResult
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val records: Array<RecordResult>
27
+ ) {
28
+ /* main constructor */
29
+ }
@@ -0,0 +1,32 @@
1
+ ///
2
+ /// RecordExistsParams.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.cloudkitmodule
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "RecordExistsParams".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class RecordExistsParams
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val recordType: String,
27
+ @DoNotStrip
28
+ @Keep
29
+ val recordID: String
30
+ ) {
31
+ /* main constructor */
32
+ }
@@ -0,0 +1,44 @@
1
+ ///
2
+ /// RecordResult.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.cloudkitmodule
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "RecordResult".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class RecordResult
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val recordID: String,
27
+ @DoNotStrip
28
+ @Keep
29
+ val recordType: String,
30
+ @DoNotStrip
31
+ @Keep
32
+ val data: String,
33
+ @DoNotStrip
34
+ @Keep
35
+ val meta: String,
36
+ @DoNotStrip
37
+ @Keep
38
+ val createdAt: Double,
39
+ @DoNotStrip
40
+ @Keep
41
+ val modifiedAt: Double
42
+ ) {
43
+ /* main constructor */
44
+ }
@@ -0,0 +1,38 @@
1
+ ///
2
+ /// SaveRecordParams.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.cloudkitmodule
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "SaveRecordParams".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class SaveRecordParams
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val recordType: String,
27
+ @DoNotStrip
28
+ @Keep
29
+ val recordID: String,
30
+ @DoNotStrip
31
+ @Keep
32
+ val data: String,
33
+ @DoNotStrip
34
+ @Keep
35
+ val meta: String
36
+ ) {
37
+ /* main constructor */
38
+ }
@@ -0,0 +1,32 @@
1
+ ///
2
+ /// SaveRecordResult.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.cloudkitmodule
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.margelo.nitro.core.*
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "SaveRecordResult".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class SaveRecordResult
21
+ @DoNotStrip
22
+ @Keep
23
+ constructor(
24
+ @DoNotStrip
25
+ @Keep
26
+ val recordID: String,
27
+ @DoNotStrip
28
+ @Keep
29
+ val createdAt: Double
30
+ ) {
31
+ /* main constructor */
32
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// cloudkitmoduleOnLoad.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.cloudkitmodule
9
+
10
+ import android.util.Log
11
+
12
+ internal class cloudkitmoduleOnLoad {
13
+ companion object {
14
+ private const val TAG = "cloudkitmoduleOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "cloudkitmodule".
18
+ * This method is idempotent and can be called more than once.
19
+ */
20
+ @JvmStatic
21
+ fun initializeNative() {
22
+ if (didLoad) return
23
+ try {
24
+ Log.i(TAG, "Loading cloudkitmodule C++ library...")
25
+ System.loadLibrary("cloudkitmodule")
26
+ Log.i(TAG, "Successfully loaded cloudkitmodule C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load cloudkitmodule C++ library! Is it properly installed and linked? " +
30
+ "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
31
+ throw e
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,60 @@
1
+ #
2
+ # CloudKitModule+autolinking.rb
3
+ # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ # https://github.com/mrousavy/nitro
5
+ # Copyright © 2025 Marc Rousavy @ Margelo
6
+ #
7
+
8
+ # 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/CloudKitModule+autolinking.rb'
18
+ # add_nitrogen_files(spec)
19
+ # end
20
+ # ```
21
+
22
+ def add_nitrogen_files(spec)
23
+ Pod::UI.puts "[NitroModules] 🔥 CloudKitModule 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/CloudKitModule-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 C)
56
+ "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
+ # Enables stricter modular headers
58
+ "DEFINES_MODULE" => "YES",
59
+ })
60
+ end
@@ -0,0 +1,80 @@
1
+ ///
2
+ /// CloudKitModule-Swift-Cxx-Bridge.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "CloudKitModule-Swift-Cxx-Bridge.hpp"
9
+
10
+ // Include C++ implementation defined types
11
+ #include "CloudKitModule-Swift-Cxx-Umbrella.hpp"
12
+ #include "HybridCloudKitModuleSpecSwift.hpp"
13
+
14
+ namespace margelo::nitro::cloudkitmodule::bridge::swift {
15
+
16
+ // pragma MARK: std::function<void(bool /* result */)>
17
+ Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
18
+ auto swiftClosure = CloudKitModule::Func_void_bool::fromUnsafe(swiftClosureWrapper);
19
+ return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
20
+ swiftClosure.call(result);
21
+ };
22
+ }
23
+
24
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
25
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
26
+ auto swiftClosure = CloudKitModule::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
27
+ return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
28
+ swiftClosure.call(error);
29
+ };
30
+ }
31
+
32
+ // pragma MARK: std::function<void(const AccountInfoResult& /* result */)>
33
+ Func_void_AccountInfoResult create_Func_void_AccountInfoResult(void* NON_NULL swiftClosureWrapper) noexcept {
34
+ auto swiftClosure = CloudKitModule::Func_void_AccountInfoResult::fromUnsafe(swiftClosureWrapper);
35
+ return [swiftClosure = std::move(swiftClosure)](const AccountInfoResult& result) mutable -> void {
36
+ swiftClosure.call(result);
37
+ };
38
+ }
39
+
40
+ // pragma MARK: std::function<void(const SaveRecordResult& /* result */)>
41
+ Func_void_SaveRecordResult create_Func_void_SaveRecordResult(void* NON_NULL swiftClosureWrapper) noexcept {
42
+ auto swiftClosure = CloudKitModule::Func_void_SaveRecordResult::fromUnsafe(swiftClosureWrapper);
43
+ return [swiftClosure = std::move(swiftClosure)](const SaveRecordResult& result) mutable -> void {
44
+ swiftClosure.call(result);
45
+ };
46
+ }
47
+
48
+ // pragma MARK: std::function<void(const std::optional<RecordResult>& /* result */)>
49
+ Func_void_std__optional_RecordResult_ create_Func_void_std__optional_RecordResult_(void* NON_NULL swiftClosureWrapper) noexcept {
50
+ auto swiftClosure = CloudKitModule::Func_void_std__optional_RecordResult_::fromUnsafe(swiftClosureWrapper);
51
+ return [swiftClosure = std::move(swiftClosure)](const std::optional<RecordResult>& result) mutable -> void {
52
+ swiftClosure.call(result);
53
+ };
54
+ }
55
+
56
+ // pragma MARK: std::function<void(const QueryRecordsResult& /* result */)>
57
+ Func_void_QueryRecordsResult create_Func_void_QueryRecordsResult(void* NON_NULL swiftClosureWrapper) noexcept {
58
+ auto swiftClosure = CloudKitModule::Func_void_QueryRecordsResult::fromUnsafe(swiftClosureWrapper);
59
+ return [swiftClosure = std::move(swiftClosure)](const QueryRecordsResult& result) mutable -> void {
60
+ swiftClosure.call(result);
61
+ };
62
+ }
63
+
64
+ // pragma MARK: std::shared_ptr<HybridCloudKitModuleSpec>
65
+ std::shared_ptr<HybridCloudKitModuleSpec> create_std__shared_ptr_HybridCloudKitModuleSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
66
+ CloudKitModule::HybridCloudKitModuleSpec_cxx swiftPart = CloudKitModule::HybridCloudKitModuleSpec_cxx::fromUnsafe(swiftUnsafePointer);
67
+ return std::make_shared<margelo::nitro::cloudkitmodule::HybridCloudKitModuleSpecSwift>(swiftPart);
68
+ }
69
+ void* NON_NULL get_std__shared_ptr_HybridCloudKitModuleSpec_(std__shared_ptr_HybridCloudKitModuleSpec_ cppType) noexcept {
70
+ std::shared_ptr<margelo::nitro::cloudkitmodule::HybridCloudKitModuleSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::cloudkitmodule::HybridCloudKitModuleSpecSwift>(cppType);
71
+ #ifdef NITRO_DEBUG
72
+ if (swiftWrapper == nullptr) [[unlikely]] {
73
+ throw std::runtime_error("Class \"HybridCloudKitModuleSpec\" is not implemented in Swift!");
74
+ }
75
+ #endif
76
+ CloudKitModule::HybridCloudKitModuleSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
77
+ return swiftPart.toUnsafe();
78
+ }
79
+
80
+ } // namespace margelo::nitro::cloudkitmodule::bridge::swift