@renegades/react-native-tickle 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 +21 -0
- package/README.md +352 -0
- package/Tickle.podspec +29 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +126 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/tickle/Tickle.kt +71 -0
- package/android/src/main/java/com/margelo/nitro/tickle/TicklePackage.kt +22 -0
- package/ios/Tickle.swift +185 -0
- package/ios/TickleUtils.swift +404 -0
- package/lib/module/Tickle.nitro.js +4 -0
- package/lib/module/Tickle.nitro.js.map +1 -0
- package/lib/module/index.js +254 -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/Tickle.nitro.d.ts +63 -0
- package/lib/typescript/src/Tickle.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +148 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/nitro.json +17 -0
- package/nitrogen/generated/android/c++/JHapticCurve.hpp +87 -0
- package/nitrogen/generated/android/c++/JHapticCurveControlPoint.hpp +61 -0
- package/nitrogen/generated/android/c++/JHapticEvent.hpp +94 -0
- package/nitrogen/generated/android/c++/JHapticEventParameter.hpp +62 -0
- package/nitrogen/generated/android/c++/JHapticEventType.hpp +58 -0
- package/nitrogen/generated/android/c++/JHapticImpactStyle.hpp +67 -0
- package/nitrogen/generated/android/c++/JHapticNotificationType.hpp +61 -0
- package/nitrogen/generated/android/c++/JHapticParameterType.hpp +58 -0
- package/nitrogen/generated/android/c++/JHybridTickleSpec.cpp +162 -0
- package/nitrogen/generated/android/c++/JHybridTickleSpec.hpp +79 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticCurve.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticCurveControlPoint.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticEvent.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticEventParameter.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticEventType.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticImpactStyle.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticNotificationType.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HapticParameterType.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/HybridTickleSpec.kt +109 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/tickle/tickleOnLoad.kt +35 -0
- package/nitrogen/generated/android/tickle+autolinking.cmake +81 -0
- package/nitrogen/generated/android/tickle+autolinking.gradle +27 -0
- package/nitrogen/generated/android/tickleOnLoad.cpp +44 -0
- package/nitrogen/generated/android/tickleOnLoad.hpp +25 -0
- package/nitrogen/generated/ios/Tickle+autolinking.rb +60 -0
- package/nitrogen/generated/ios/Tickle-Swift-Cxx-Bridge.cpp +33 -0
- package/nitrogen/generated/ios/Tickle-Swift-Cxx-Bridge.hpp +139 -0
- package/nitrogen/generated/ios/Tickle-Swift-Cxx-Umbrella.hpp +70 -0
- package/nitrogen/generated/ios/TickleAutolinking.mm +33 -0
- package/nitrogen/generated/ios/TickleAutolinking.swift +25 -0
- package/nitrogen/generated/ios/c++/HybridTickleSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridTickleSpecSwift.hpp +185 -0
- package/nitrogen/generated/ios/swift/HapticCurve.swift +46 -0
- package/nitrogen/generated/ios/swift/HapticCurveControlPoint.swift +35 -0
- package/nitrogen/generated/ios/swift/HapticEvent.swift +57 -0
- package/nitrogen/generated/ios/swift/HapticEventParameter.swift +35 -0
- package/nitrogen/generated/ios/swift/HapticEventType.swift +40 -0
- package/nitrogen/generated/ios/swift/HapticImpactStyle.swift +52 -0
- package/nitrogen/generated/ios/swift/HapticNotificationType.swift +44 -0
- package/nitrogen/generated/ios/swift/HapticParameterType.swift +40 -0
- package/nitrogen/generated/ios/swift/HybridTickleSpec.swift +69 -0
- package/nitrogen/generated/ios/swift/HybridTickleSpec_cxx.swift +282 -0
- package/nitrogen/generated/shared/c++/HapticCurve.hpp +96 -0
- package/nitrogen/generated/shared/c++/HapticCurveControlPoint.hpp +87 -0
- package/nitrogen/generated/shared/c++/HapticEvent.hpp +101 -0
- package/nitrogen/generated/shared/c++/HapticEventParameter.hpp +88 -0
- package/nitrogen/generated/shared/c++/HapticEventType.hpp +76 -0
- package/nitrogen/generated/shared/c++/HapticImpactStyle.hpp +88 -0
- package/nitrogen/generated/shared/c++/HapticNotificationType.hpp +80 -0
- package/nitrogen/generated/shared/c++/HapticParameterType.hpp +76 -0
- package/nitrogen/generated/shared/c++/HybridTickleSpec.cpp +34 -0
- package/nitrogen/generated/shared/c++/HybridTickleSpec.hpp +87 -0
- package/package.json +179 -0
- package/react-native.config.js +8 -0
- package/src/Tickle.nitro.ts +84 -0
- package/src/index.tsx +306 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Tickle-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 "Tickle-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridTickleSpecSwift.hpp"
|
|
12
|
+
#include "Tickle-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::tickle::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::shared_ptr<HybridTickleSpec>
|
|
18
|
+
std::shared_ptr<HybridTickleSpec> create_std__shared_ptr_HybridTickleSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
19
|
+
Tickle::HybridTickleSpec_cxx swiftPart = Tickle::HybridTickleSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
20
|
+
return std::make_shared<margelo::nitro::tickle::HybridTickleSpecSwift>(swiftPart);
|
|
21
|
+
}
|
|
22
|
+
void* NON_NULL get_std__shared_ptr_HybridTickleSpec_(std__shared_ptr_HybridTickleSpec_ cppType) {
|
|
23
|
+
std::shared_ptr<margelo::nitro::tickle::HybridTickleSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::tickle::HybridTickleSpecSwift>(cppType);
|
|
24
|
+
#ifdef NITRO_DEBUG
|
|
25
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
26
|
+
throw std::runtime_error("Class \"HybridTickleSpec\" is not implemented in Swift!");
|
|
27
|
+
}
|
|
28
|
+
#endif
|
|
29
|
+
Tickle::HybridTickleSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
30
|
+
return swiftPart.toUnsafe();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
} // namespace margelo::nitro::tickle::bridge::swift
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Tickle-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 `HapticCurveControlPoint` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::tickle { struct HapticCurveControlPoint; }
|
|
13
|
+
// Forward declaration of `HapticCurve` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::tickle { struct HapticCurve; }
|
|
15
|
+
// Forward declaration of `HapticEventParameter` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::tickle { struct HapticEventParameter; }
|
|
17
|
+
// Forward declaration of `HapticEventType` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::tickle { enum class HapticEventType; }
|
|
19
|
+
// Forward declaration of `HapticEvent` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::tickle { struct HapticEvent; }
|
|
21
|
+
// Forward declaration of `HapticParameterType` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::tickle { enum class HapticParameterType; }
|
|
23
|
+
// Forward declaration of `HybridTickleSpec` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::tickle { class HybridTickleSpec; }
|
|
25
|
+
|
|
26
|
+
// Forward declarations of Swift defined types
|
|
27
|
+
// Forward declaration of `HybridTickleSpec_cxx` to properly resolve imports.
|
|
28
|
+
namespace Tickle { class HybridTickleSpec_cxx; }
|
|
29
|
+
|
|
30
|
+
// Include C++ defined types
|
|
31
|
+
#include "HapticCurve.hpp"
|
|
32
|
+
#include "HapticCurveControlPoint.hpp"
|
|
33
|
+
#include "HapticEvent.hpp"
|
|
34
|
+
#include "HapticEventParameter.hpp"
|
|
35
|
+
#include "HapticEventType.hpp"
|
|
36
|
+
#include "HapticParameterType.hpp"
|
|
37
|
+
#include "HybridTickleSpec.hpp"
|
|
38
|
+
#include <NitroModules/Result.hpp>
|
|
39
|
+
#include <exception>
|
|
40
|
+
#include <memory>
|
|
41
|
+
#include <optional>
|
|
42
|
+
#include <vector>
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
46
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
47
|
+
*/
|
|
48
|
+
namespace margelo::nitro::tickle::bridge::swift {
|
|
49
|
+
|
|
50
|
+
// pragma MARK: std::vector<HapticEventParameter>
|
|
51
|
+
/**
|
|
52
|
+
* Specialized version of `std::vector<HapticEventParameter>`.
|
|
53
|
+
*/
|
|
54
|
+
using std__vector_HapticEventParameter_ = std::vector<HapticEventParameter>;
|
|
55
|
+
inline std::vector<HapticEventParameter> create_std__vector_HapticEventParameter_(size_t size) noexcept {
|
|
56
|
+
std::vector<HapticEventParameter> vector;
|
|
57
|
+
vector.reserve(size);
|
|
58
|
+
return vector;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// pragma MARK: std::optional<double>
|
|
62
|
+
/**
|
|
63
|
+
* Specialized version of `std::optional<double>`.
|
|
64
|
+
*/
|
|
65
|
+
using std__optional_double_ = std::optional<double>;
|
|
66
|
+
inline std::optional<double> create_std__optional_double_(const double& value) noexcept {
|
|
67
|
+
return std::optional<double>(value);
|
|
68
|
+
}
|
|
69
|
+
inline bool has_value_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
70
|
+
return optional.has_value();
|
|
71
|
+
}
|
|
72
|
+
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
73
|
+
return *optional;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// pragma MARK: std::vector<HapticEvent>
|
|
77
|
+
/**
|
|
78
|
+
* Specialized version of `std::vector<HapticEvent>`.
|
|
79
|
+
*/
|
|
80
|
+
using std__vector_HapticEvent_ = std::vector<HapticEvent>;
|
|
81
|
+
inline std::vector<HapticEvent> create_std__vector_HapticEvent_(size_t size) noexcept {
|
|
82
|
+
std::vector<HapticEvent> vector;
|
|
83
|
+
vector.reserve(size);
|
|
84
|
+
return vector;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// pragma MARK: std::vector<HapticCurveControlPoint>
|
|
88
|
+
/**
|
|
89
|
+
* Specialized version of `std::vector<HapticCurveControlPoint>`.
|
|
90
|
+
*/
|
|
91
|
+
using std__vector_HapticCurveControlPoint_ = std::vector<HapticCurveControlPoint>;
|
|
92
|
+
inline std::vector<HapticCurveControlPoint> create_std__vector_HapticCurveControlPoint_(size_t size) noexcept {
|
|
93
|
+
std::vector<HapticCurveControlPoint> vector;
|
|
94
|
+
vector.reserve(size);
|
|
95
|
+
return vector;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// pragma MARK: std::vector<HapticCurve>
|
|
99
|
+
/**
|
|
100
|
+
* Specialized version of `std::vector<HapticCurve>`.
|
|
101
|
+
*/
|
|
102
|
+
using std__vector_HapticCurve_ = std::vector<HapticCurve>;
|
|
103
|
+
inline std::vector<HapticCurve> create_std__vector_HapticCurve_(size_t size) noexcept {
|
|
104
|
+
std::vector<HapticCurve> vector;
|
|
105
|
+
vector.reserve(size);
|
|
106
|
+
return vector;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// pragma MARK: std::shared_ptr<HybridTickleSpec>
|
|
110
|
+
/**
|
|
111
|
+
* Specialized version of `std::shared_ptr<HybridTickleSpec>`.
|
|
112
|
+
*/
|
|
113
|
+
using std__shared_ptr_HybridTickleSpec_ = std::shared_ptr<HybridTickleSpec>;
|
|
114
|
+
std::shared_ptr<HybridTickleSpec> create_std__shared_ptr_HybridTickleSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
115
|
+
void* NON_NULL get_std__shared_ptr_HybridTickleSpec_(std__shared_ptr_HybridTickleSpec_ cppType);
|
|
116
|
+
|
|
117
|
+
// pragma MARK: std::weak_ptr<HybridTickleSpec>
|
|
118
|
+
using std__weak_ptr_HybridTickleSpec_ = std::weak_ptr<HybridTickleSpec>;
|
|
119
|
+
inline std__weak_ptr_HybridTickleSpec_ weakify_std__shared_ptr_HybridTickleSpec_(const std::shared_ptr<HybridTickleSpec>& strong) noexcept { return strong; }
|
|
120
|
+
|
|
121
|
+
// pragma MARK: Result<void>
|
|
122
|
+
using Result_void_ = Result<void>;
|
|
123
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
124
|
+
return Result<void>::withValue();
|
|
125
|
+
}
|
|
126
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
127
|
+
return Result<void>::withError(error);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// pragma MARK: Result<bool>
|
|
131
|
+
using Result_bool_ = Result<bool>;
|
|
132
|
+
inline Result_bool_ create_Result_bool_(bool value) noexcept {
|
|
133
|
+
return Result<bool>::withValue(std::move(value));
|
|
134
|
+
}
|
|
135
|
+
inline Result_bool_ create_Result_bool_(const std::exception_ptr& error) noexcept {
|
|
136
|
+
return Result<bool>::withError(error);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
} // namespace margelo::nitro::tickle::bridge::swift
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Tickle-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 `HapticCurveControlPoint` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::tickle { struct HapticCurveControlPoint; }
|
|
13
|
+
// Forward declaration of `HapticCurve` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::tickle { struct HapticCurve; }
|
|
15
|
+
// Forward declaration of `HapticEventParameter` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::tickle { struct HapticEventParameter; }
|
|
17
|
+
// Forward declaration of `HapticEventType` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::tickle { enum class HapticEventType; }
|
|
19
|
+
// Forward declaration of `HapticEvent` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::tickle { struct HapticEvent; }
|
|
21
|
+
// Forward declaration of `HapticImpactStyle` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::tickle { enum class HapticImpactStyle; }
|
|
23
|
+
// Forward declaration of `HapticNotificationType` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::tickle { enum class HapticNotificationType; }
|
|
25
|
+
// Forward declaration of `HapticParameterType` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::tickle { enum class HapticParameterType; }
|
|
27
|
+
// Forward declaration of `HybridTickleSpec` to properly resolve imports.
|
|
28
|
+
namespace margelo::nitro::tickle { class HybridTickleSpec; }
|
|
29
|
+
|
|
30
|
+
// Include C++ defined types
|
|
31
|
+
#include "HapticCurve.hpp"
|
|
32
|
+
#include "HapticCurveControlPoint.hpp"
|
|
33
|
+
#include "HapticEvent.hpp"
|
|
34
|
+
#include "HapticEventParameter.hpp"
|
|
35
|
+
#include "HapticEventType.hpp"
|
|
36
|
+
#include "HapticImpactStyle.hpp"
|
|
37
|
+
#include "HapticNotificationType.hpp"
|
|
38
|
+
#include "HapticParameterType.hpp"
|
|
39
|
+
#include "HybridTickleSpec.hpp"
|
|
40
|
+
#include <NitroModules/Result.hpp>
|
|
41
|
+
#include <exception>
|
|
42
|
+
#include <memory>
|
|
43
|
+
#include <optional>
|
|
44
|
+
#include <string>
|
|
45
|
+
#include <vector>
|
|
46
|
+
|
|
47
|
+
// C++ helpers for Swift
|
|
48
|
+
#include "Tickle-Swift-Cxx-Bridge.hpp"
|
|
49
|
+
|
|
50
|
+
// Common C++ types used in Swift
|
|
51
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
52
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
53
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
54
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
55
|
+
|
|
56
|
+
// Forward declarations of Swift defined types
|
|
57
|
+
// Forward declaration of `HybridTickleSpec_cxx` to properly resolve imports.
|
|
58
|
+
namespace Tickle { class HybridTickleSpec_cxx; }
|
|
59
|
+
|
|
60
|
+
// Include Swift defined types
|
|
61
|
+
#if __has_include("Tickle-Swift.h")
|
|
62
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
63
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "Tickle".
|
|
64
|
+
#include "Tickle-Swift.h"
|
|
65
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
66
|
+
#elif __has_include(<Tickle/Tickle-Swift.h>)
|
|
67
|
+
#include <Tickle/Tickle-Swift.h>
|
|
68
|
+
#else
|
|
69
|
+
#error Tickle's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "Tickle", and try building the app first.
|
|
70
|
+
#endif
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// TickleAutolinking.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 "Tickle-Swift-Cxx-Umbrella.hpp"
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridTickleSpecSwift.hpp"
|
|
14
|
+
|
|
15
|
+
@interface TickleAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation TickleAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::tickle;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"Tickle",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
std::shared_ptr<HybridTickleSpec> hybridObject = Tickle::TickleAutolinking::createTickle();
|
|
28
|
+
return hybridObject;
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// TickleAutolinking.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
|
+
public final class TickleAutolinking {
|
|
9
|
+
public typealias bridge = margelo.nitro.tickle.bridge.swift
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of a Swift class that implements `HybridTickleSpec`,
|
|
13
|
+
* and wraps it in a Swift class that can directly interop with C++ (`HybridTickleSpec_cxx`)
|
|
14
|
+
*
|
|
15
|
+
* This is generated by Nitrogen and will initialize the class specified
|
|
16
|
+
* in the `"autolinking"` property of `nitro.json` (in this case, `Tickle`).
|
|
17
|
+
*/
|
|
18
|
+
public static func createTickle() -> bridge.std__shared_ptr_HybridTickleSpec_ {
|
|
19
|
+
let hybridObject = Tickle()
|
|
20
|
+
return { () -> bridge.std__shared_ptr_HybridTickleSpec_ in
|
|
21
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
22
|
+
return __cxxWrapped.getCxxPart()
|
|
23
|
+
}()
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridTickleSpecSwift.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 "HybridTickleSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::tickle {
|
|
11
|
+
} // namespace margelo::nitro::tickle
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridTickleSpecSwift.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 "HybridTickleSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridTickleSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace Tickle { class HybridTickleSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `HapticEvent` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::tickle { struct HapticEvent; }
|
|
17
|
+
// Forward declaration of `HapticEventType` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::tickle { enum class HapticEventType; }
|
|
19
|
+
// Forward declaration of `HapticEventParameter` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::tickle { struct HapticEventParameter; }
|
|
21
|
+
// Forward declaration of `HapticParameterType` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::tickle { enum class HapticParameterType; }
|
|
23
|
+
// Forward declaration of `HapticCurve` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::tickle { struct HapticCurve; }
|
|
25
|
+
// Forward declaration of `HapticCurveControlPoint` to properly resolve imports.
|
|
26
|
+
namespace margelo::nitro::tickle { struct HapticCurveControlPoint; }
|
|
27
|
+
// Forward declaration of `HapticImpactStyle` to properly resolve imports.
|
|
28
|
+
namespace margelo::nitro::tickle { enum class HapticImpactStyle; }
|
|
29
|
+
// Forward declaration of `HapticNotificationType` to properly resolve imports.
|
|
30
|
+
namespace margelo::nitro::tickle { enum class HapticNotificationType; }
|
|
31
|
+
|
|
32
|
+
#include "HapticEvent.hpp"
|
|
33
|
+
#include <vector>
|
|
34
|
+
#include "HapticEventType.hpp"
|
|
35
|
+
#include "HapticEventParameter.hpp"
|
|
36
|
+
#include "HapticParameterType.hpp"
|
|
37
|
+
#include <optional>
|
|
38
|
+
#include "HapticCurve.hpp"
|
|
39
|
+
#include "HapticCurveControlPoint.hpp"
|
|
40
|
+
#include <string>
|
|
41
|
+
#include "HapticImpactStyle.hpp"
|
|
42
|
+
#include "HapticNotificationType.hpp"
|
|
43
|
+
|
|
44
|
+
#include "Tickle-Swift-Cxx-Umbrella.hpp"
|
|
45
|
+
|
|
46
|
+
namespace margelo::nitro::tickle {
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The C++ part of HybridTickleSpec_cxx.swift.
|
|
50
|
+
*
|
|
51
|
+
* HybridTickleSpecSwift (C++) accesses HybridTickleSpec_cxx (Swift), and might
|
|
52
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
53
|
+
*
|
|
54
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
55
|
+
* the future, HybridTickleSpec_cxx can directly inherit from the C++ class HybridTickleSpec
|
|
56
|
+
* to simplify the whole structure and memory management.
|
|
57
|
+
*/
|
|
58
|
+
class HybridTickleSpecSwift: public virtual HybridTickleSpec {
|
|
59
|
+
public:
|
|
60
|
+
// Constructor from a Swift instance
|
|
61
|
+
explicit HybridTickleSpecSwift(const Tickle::HybridTickleSpec_cxx& swiftPart):
|
|
62
|
+
HybridObject(HybridTickleSpec::TAG),
|
|
63
|
+
_swiftPart(swiftPart) { }
|
|
64
|
+
|
|
65
|
+
public:
|
|
66
|
+
// Get the Swift part
|
|
67
|
+
inline Tickle::HybridTickleSpec_cxx& getSwiftPart() noexcept {
|
|
68
|
+
return _swiftPart;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public:
|
|
72
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
73
|
+
return _swiftPart.getMemorySize();
|
|
74
|
+
}
|
|
75
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
76
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridTickleSpecSwift>(other)) {
|
|
77
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
void dispose() noexcept override {
|
|
82
|
+
_swiftPart.dispose();
|
|
83
|
+
}
|
|
84
|
+
std::string toString() override {
|
|
85
|
+
return _swiftPart.toString();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public:
|
|
89
|
+
// Properties
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
public:
|
|
93
|
+
// Methods
|
|
94
|
+
inline void startHaptic(const std::vector<HapticEvent>& events, const std::vector<HapticCurve>& curves) override {
|
|
95
|
+
auto __result = _swiftPart.startHaptic(events, curves);
|
|
96
|
+
if (__result.hasError()) [[unlikely]] {
|
|
97
|
+
std::rethrow_exception(__result.error());
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
inline void stopAllHaptics() override {
|
|
101
|
+
auto __result = _swiftPart.stopAllHaptics();
|
|
102
|
+
if (__result.hasError()) [[unlikely]] {
|
|
103
|
+
std::rethrow_exception(__result.error());
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
inline void initializeEngine() override {
|
|
107
|
+
auto __result = _swiftPart.initializeEngine();
|
|
108
|
+
if (__result.hasError()) [[unlikely]] {
|
|
109
|
+
std::rethrow_exception(__result.error());
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
inline void destroyEngine() override {
|
|
113
|
+
auto __result = _swiftPart.destroyEngine();
|
|
114
|
+
if (__result.hasError()) [[unlikely]] {
|
|
115
|
+
std::rethrow_exception(__result.error());
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
inline void createContinuousPlayer(const std::string& playerId, double initialIntensity, double initialSharpness) override {
|
|
119
|
+
auto __result = _swiftPart.createContinuousPlayer(playerId, std::forward<decltype(initialIntensity)>(initialIntensity), std::forward<decltype(initialSharpness)>(initialSharpness));
|
|
120
|
+
if (__result.hasError()) [[unlikely]] {
|
|
121
|
+
std::rethrow_exception(__result.error());
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
inline void startContinuousPlayer(const std::string& playerId) override {
|
|
125
|
+
auto __result = _swiftPart.startContinuousPlayer(playerId);
|
|
126
|
+
if (__result.hasError()) [[unlikely]] {
|
|
127
|
+
std::rethrow_exception(__result.error());
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
inline void updateContinuousPlayer(const std::string& playerId, double intensityControl, double sharpnessControl) override {
|
|
131
|
+
auto __result = _swiftPart.updateContinuousPlayer(playerId, std::forward<decltype(intensityControl)>(intensityControl), std::forward<decltype(sharpnessControl)>(sharpnessControl));
|
|
132
|
+
if (__result.hasError()) [[unlikely]] {
|
|
133
|
+
std::rethrow_exception(__result.error());
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
inline void stopContinuousPlayer(const std::string& playerId) override {
|
|
137
|
+
auto __result = _swiftPart.stopContinuousPlayer(playerId);
|
|
138
|
+
if (__result.hasError()) [[unlikely]] {
|
|
139
|
+
std::rethrow_exception(__result.error());
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
inline void destroyContinuousPlayer(const std::string& playerId) override {
|
|
143
|
+
auto __result = _swiftPart.destroyContinuousPlayer(playerId);
|
|
144
|
+
if (__result.hasError()) [[unlikely]] {
|
|
145
|
+
std::rethrow_exception(__result.error());
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
inline void setHapticsEnabled(bool enabled) override {
|
|
149
|
+
auto __result = _swiftPart.setHapticsEnabled(std::forward<decltype(enabled)>(enabled));
|
|
150
|
+
if (__result.hasError()) [[unlikely]] {
|
|
151
|
+
std::rethrow_exception(__result.error());
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
inline bool getHapticsEnabled() override {
|
|
155
|
+
auto __result = _swiftPart.getHapticsEnabled();
|
|
156
|
+
if (__result.hasError()) [[unlikely]] {
|
|
157
|
+
std::rethrow_exception(__result.error());
|
|
158
|
+
}
|
|
159
|
+
auto __value = std::move(__result.value());
|
|
160
|
+
return __value;
|
|
161
|
+
}
|
|
162
|
+
inline void triggerImpact(HapticImpactStyle style) override {
|
|
163
|
+
auto __result = _swiftPart.triggerImpact(static_cast<int>(style));
|
|
164
|
+
if (__result.hasError()) [[unlikely]] {
|
|
165
|
+
std::rethrow_exception(__result.error());
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
inline void triggerNotification(HapticNotificationType type) override {
|
|
169
|
+
auto __result = _swiftPart.triggerNotification(static_cast<int>(type));
|
|
170
|
+
if (__result.hasError()) [[unlikely]] {
|
|
171
|
+
std::rethrow_exception(__result.error());
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
inline void triggerSelection() override {
|
|
175
|
+
auto __result = _swiftPart.triggerSelection();
|
|
176
|
+
if (__result.hasError()) [[unlikely]] {
|
|
177
|
+
std::rethrow_exception(__result.error());
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
private:
|
|
182
|
+
Tickle::HybridTickleSpec_cxx _swiftPart;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
} // namespace margelo::nitro::tickle
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HapticCurve.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 Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents an instance of `HapticCurve`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias HapticCurve = margelo.nitro.tickle.HapticCurve
|
|
15
|
+
|
|
16
|
+
public extension HapticCurve {
|
|
17
|
+
private typealias bridge = margelo.nitro.tickle.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `HapticCurve`.
|
|
21
|
+
*/
|
|
22
|
+
init(type: HapticParameterType, controlPoints: [HapticCurveControlPoint], relativeTime: Double) {
|
|
23
|
+
self.init(type, { () -> bridge.std__vector_HapticCurveControlPoint_ in
|
|
24
|
+
var __vector = bridge.create_std__vector_HapticCurveControlPoint_(controlPoints.count)
|
|
25
|
+
for __item in controlPoints {
|
|
26
|
+
__vector.push_back(__item)
|
|
27
|
+
}
|
|
28
|
+
return __vector
|
|
29
|
+
}(), relativeTime)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@inline(__always)
|
|
33
|
+
var type: HapticParameterType {
|
|
34
|
+
return self.__type
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@inline(__always)
|
|
38
|
+
var controlPoints: [HapticCurveControlPoint] {
|
|
39
|
+
return self.__controlPoints.map({ __item in __item })
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@inline(__always)
|
|
43
|
+
var relativeTime: Double {
|
|
44
|
+
return self.__relativeTime
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HapticCurveControlPoint.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 Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents an instance of `HapticCurveControlPoint`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias HapticCurveControlPoint = margelo.nitro.tickle.HapticCurveControlPoint
|
|
15
|
+
|
|
16
|
+
public extension HapticCurveControlPoint {
|
|
17
|
+
private typealias bridge = margelo.nitro.tickle.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `HapticCurveControlPoint`.
|
|
21
|
+
*/
|
|
22
|
+
init(relativeTime: Double, value: Double) {
|
|
23
|
+
self.init(relativeTime, value)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@inline(__always)
|
|
27
|
+
var relativeTime: Double {
|
|
28
|
+
return self.__relativeTime
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@inline(__always)
|
|
32
|
+
var value: Double {
|
|
33
|
+
return self.__value
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HapticEvent.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 Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents an instance of `HapticEvent`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias HapticEvent = margelo.nitro.tickle.HapticEvent
|
|
15
|
+
|
|
16
|
+
public extension HapticEvent {
|
|
17
|
+
private typealias bridge = margelo.nitro.tickle.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `HapticEvent`.
|
|
21
|
+
*/
|
|
22
|
+
init(type: HapticEventType, parameters: [HapticEventParameter], relativeTime: Double, duration: Double?) {
|
|
23
|
+
self.init(type, { () -> bridge.std__vector_HapticEventParameter_ in
|
|
24
|
+
var __vector = bridge.create_std__vector_HapticEventParameter_(parameters.count)
|
|
25
|
+
for __item in parameters {
|
|
26
|
+
__vector.push_back(__item)
|
|
27
|
+
}
|
|
28
|
+
return __vector
|
|
29
|
+
}(), relativeTime, { () -> bridge.std__optional_double_ in
|
|
30
|
+
if let __unwrappedValue = duration {
|
|
31
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
32
|
+
} else {
|
|
33
|
+
return .init()
|
|
34
|
+
}
|
|
35
|
+
}())
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@inline(__always)
|
|
39
|
+
var type: HapticEventType {
|
|
40
|
+
return self.__type
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@inline(__always)
|
|
44
|
+
var parameters: [HapticEventParameter] {
|
|
45
|
+
return self.__parameters.map({ __item in __item })
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@inline(__always)
|
|
49
|
+
var relativeTime: Double {
|
|
50
|
+
return self.__relativeTime
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
@inline(__always)
|
|
54
|
+
var duration: Double? {
|
|
55
|
+
return self.__duration.value
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HapticEventParameter.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 Foundation
|
|
9
|
+
import NitroModules
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Represents an instance of `HapticEventParameter`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias HapticEventParameter = margelo.nitro.tickle.HapticEventParameter
|
|
15
|
+
|
|
16
|
+
public extension HapticEventParameter {
|
|
17
|
+
private typealias bridge = margelo.nitro.tickle.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `HapticEventParameter`.
|
|
21
|
+
*/
|
|
22
|
+
init(type: HapticParameterType, value: Double) {
|
|
23
|
+
self.init(type, value)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@inline(__always)
|
|
27
|
+
var type: HapticParameterType {
|
|
28
|
+
return self.__type
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@inline(__always)
|
|
32
|
+
var value: Double {
|
|
33
|
+
return self.__value
|
|
34
|
+
}
|
|
35
|
+
}
|