nitrowind-native 0.0.0-stage → 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/CHANGELOG.md +16 -0
- package/LICENSE +21 -0
- package/Package.swift +104 -0
- package/README.md +35 -2
- package/android/src/main/java/com/margelo/nitro/nitrowind/HybridReducedMotion.kt +79 -0
- package/android/src/main/java/com/margelo/nitro/nitrowind/HybridThemeCover.kt +38 -0
- package/android/src/main/java/com/margelo/nitro/nitrowind/NitroWindCoverLog.kt +36 -0
- package/android/src/main/java/com/margelo/nitro/nitrowind/ThemeCoverActivityInitializer.kt +11 -0
- package/android/src/main/java/com/margelo/nitro/nitrowind/ThemeCoverController.kt +619 -0
- package/ios/HybridReducedMotion.swift +50 -0
- package/ios/HybridThemeCover.swift +46 -0
- package/ios/NitroWindCoverLog.swift +40 -0
- package/ios/ThemeCoverWindow.swift +324 -0
- package/nitro.json +13 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroWindNative+autolinking.cmake +34 -0
- package/nitrogen/generated/android/NitroWindNative+autolinking.gradle +10 -0
- package/nitrogen/generated/android/NitroWindNativeOnLoad.cpp +25 -0
- package/nitrogen/generated/android/c++/JCallback_void.cpp +54 -0
- package/nitrogen/generated/android/c++/JCallback_void_bool.cpp +56 -0
- package/nitrogen/generated/android/c++/JCoverRequest.cpp +42 -0
- package/nitrogen/generated/android/c++/JHybridReducedMotionSpec.cpp +84 -0
- package/nitrogen/generated/android/c++/JHybridThemeCoverSpec.cpp +114 -0
- package/nitrogen/generated/android/c++/JListenerSubscription.cpp +34 -0
- package/nitrogen/generated/android/c++/JThemeTransitionDirection.cpp +52 -0
- package/nitrogen/generated/android/c++/JThemeTransitionStyle.cpp +58 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JCallback_void.hpp +53 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JCallback_void_bool.hpp +55 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JCoverRequest.hpp +73 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JHybridReducedMotionSpec.hpp +90 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JHybridReducedMotionSpecJavaPart.hpp +26 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JHybridThemeCoverSpec.hpp +96 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JHybridThemeCoverSpecJavaPart.hpp +26 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JListenerSubscription.hpp +49 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JThemeTransitionDirection.hpp +72 -0
- package/nitrogen/generated/android/c++/include/NitroWindNative/private/JThemeTransitionStyle.hpp +82 -0
- package/nitrogen/generated/android/include/NitroWindNative/private/NitroWindNativeOnLoad.hpp +13 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/Callback_void.kt +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/Callback_void_bool.kt +69 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/CoverRequest.kt +67 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/HybridReducedMotionSpec.kt +89 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/HybridThemeCoverSpec.kt +107 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/ListenerSubscription.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/NitroWindNativeOnLoad.kt +22 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/ThemeTransitionDirection.kt +46 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrowind/ThemeTransitionStyle.kt +52 -0
- package/nitrogen/generated/apple/NitroWindNative-Swift-Cxx-Bridge.cpp +68 -0
- package/nitrogen/generated/apple/NitroWindNativeAppleCxx/NitroWindNativeAppleCxx.cpp +9 -0
- package/nitrogen/generated/apple/NitroWindNativeAppleCxx/include/NitroWindNativeAppleCxx/NitroWindNativeAppleCxx.h +64 -0
- package/nitrogen/generated/apple/NitroWindNativeAutolinking.cpp +22 -0
- package/nitrogen/generated/apple/NitroWindNativeAutolinking.mm +24 -0
- package/nitrogen/generated/apple/c++/CoverRequest-Swift.cpp +36 -0
- package/nitrogen/generated/apple/c++/HybridReducedMotionSpecSwift.cpp +62 -0
- package/nitrogen/generated/apple/c++/HybridReducedMotionSpec_cxx-Swift.cpp +28 -0
- package/nitrogen/generated/apple/c++/HybridThemeCoverSpecSwift.cpp +104 -0
- package/nitrogen/generated/apple/c++/HybridThemeCoverSpec_cxx-Swift.cpp +28 -0
- package/nitrogen/generated/apple/c++/ListenerSubscription-Swift.cpp +37 -0
- package/nitrogen/generated/apple/c++/ThemeTransitionDirection-Swift.cpp +46 -0
- package/nitrogen/generated/apple/c++/ThemeTransitionStyle-Swift.cpp +52 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/NitroWindNativeAutolinking.hpp +13 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/CoverRequest-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/HybridReducedMotionSpecSwift.hpp +74 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/HybridReducedMotionSpec_cxx-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/HybridThemeCoverSpecSwift.hpp +79 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/HybridThemeCoverSpec_cxx-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/ListenerSubscription-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/NitroWindNative-Swift-Cxx-Umbrella.hpp +41 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/ThemeTransitionDirection-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/NitroWindNative/private/ThemeTransitionStyle-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/module.modulemap +12 -0
- package/nitrogen/generated/apple/swift/Callback_void.swift +60 -0
- package/nitrogen/generated/apple/swift/Callback_void_bool.swift +60 -0
- package/nitrogen/generated/apple/swift/CoverRequest.swift +56 -0
- package/nitrogen/generated/apple/swift/HybridReducedMotionSpec.swift +66 -0
- package/nitrogen/generated/apple/swift/HybridReducedMotionSpec_cxx.swift +164 -0
- package/nitrogen/generated/apple/swift/HybridThemeCoverSpec.swift +70 -0
- package/nitrogen/generated/apple/swift/HybridThemeCoverSpec_cxx.swift +207 -0
- package/nitrogen/generated/apple/swift/ListenerSubscription.swift +29 -0
- package/nitrogen/generated/apple/swift/Promise_bool.swift +100 -0
- package/nitrogen/generated/apple/swift/Promise_void.swift +100 -0
- package/nitrogen/generated/apple/swift/ThemeTransitionDirection.swift +54 -0
- package/nitrogen/generated/apple/swift/ThemeTransitionStyle.swift +64 -0
- package/nitrogen/generated/hybrid-classes.json +33 -0
- package/nitrogen/generated/shared/c++/NitroWindNativeCxxModule.cpp +2 -0
- package/nitrogen/generated/shared/c++/include/NitroWindNative/NitroWindNativeCxxModule.hpp +2 -0
- package/nitrogen/generated/shared/javascript/ReducedMotion.cjs +19 -0
- package/nitrogen/generated/shared/javascript/ReducedMotion.d.cts +9 -0
- package/nitrogen/generated/shared/javascript/ThemeCover.cjs +19 -0
- package/nitrogen/generated/shared/javascript/ThemeCover.d.cts +9 -0
- package/package.json +69 -4
- package/src/index.ts +59 -0
- package/src/specs/ListenerSubscription.ts +3 -0
- package/src/specs/ReducedMotion.nitro.ts +19 -0
- package/src/specs/ThemeCover.nitro.ts +49 -0
- package/src/testing.ts +18 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Callback_void.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
public import NitroModules
|
|
9
|
+
internal import CxxStdlib
|
|
10
|
+
internal import NitroWindNativeAppleCxx
|
|
11
|
+
|
|
12
|
+
public typealias Callback_void = margelo.nitro.nitrowind.swift_bridge.Callback_void
|
|
13
|
+
|
|
14
|
+
extension Callback_void {
|
|
15
|
+
public typealias Arguments = ()
|
|
16
|
+
public typealias Return = Void
|
|
17
|
+
public typealias AsyncResult = margelo.nitro.nitrowind.swift_bridge.Promise_void
|
|
18
|
+
private typealias bridge = margelo.nitro.nitrowind.swift_bridge
|
|
19
|
+
|
|
20
|
+
public borrowing func __nitroCallSync(_ arguments: Arguments) throws -> Return {
|
|
21
|
+
let __result = bridge.callSync_Callback_void(self)
|
|
22
|
+
if __result.hasError() {
|
|
23
|
+
throw RuntimeError.from(cppError: __result.error())
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
public borrowing func __nitroCallAsync(_ arguments: Arguments) -> AsyncResult {
|
|
27
|
+
return __callAsync()
|
|
28
|
+
}
|
|
29
|
+
public borrowing func __nitroCallAndForget(_ arguments: Arguments) {
|
|
30
|
+
__callAndForget()
|
|
31
|
+
}
|
|
32
|
+
public init(_ closure: @escaping @Sendable () throws -> Return) {
|
|
33
|
+
self = bridge.create_Callback_void(.init { () -> bridge.Result_void in
|
|
34
|
+
do {
|
|
35
|
+
try closure()
|
|
36
|
+
return bridge.Result_void.withValue()
|
|
37
|
+
} catch {
|
|
38
|
+
return bridge.Result_void.withError(error.toCpp())
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
extension Callback<(), Void> where Self == Callback_void {
|
|
45
|
+
/// Creates a native callback from an escaping Swift closure.
|
|
46
|
+
public static func native(_ closure: @escaping @Sendable () throws -> Void) -> Self {
|
|
47
|
+
return Self(closure)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
extension Callback<(), Void> {
|
|
52
|
+
func toCpp() -> Callback_void {
|
|
53
|
+
if let value = self as? Callback_void {
|
|
54
|
+
return value
|
|
55
|
+
}
|
|
56
|
+
return Callback_void { () -> Void in
|
|
57
|
+
try self.callSync(())
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Callback_void_bool.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
public import NitroModules
|
|
9
|
+
internal import CxxStdlib
|
|
10
|
+
internal import NitroWindNativeAppleCxx
|
|
11
|
+
|
|
12
|
+
public typealias Callback_void_bool = margelo.nitro.nitrowind.swift_bridge.Callback_void_bool
|
|
13
|
+
|
|
14
|
+
extension Callback_void_bool {
|
|
15
|
+
public typealias Arguments = (Bool)
|
|
16
|
+
public typealias Return = Void
|
|
17
|
+
public typealias AsyncResult = margelo.nitro.nitrowind.swift_bridge.Promise_void
|
|
18
|
+
private typealias bridge = margelo.nitro.nitrowind.swift_bridge
|
|
19
|
+
|
|
20
|
+
public borrowing func __nitroCallSync(_ arguments: Arguments) throws -> Return {
|
|
21
|
+
let __result = bridge.callSync_Callback_void_bool(self, arguments)
|
|
22
|
+
if __result.hasError() {
|
|
23
|
+
throw RuntimeError.from(cppError: __result.error())
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
public borrowing func __nitroCallAsync(_ arguments: Arguments) -> AsyncResult {
|
|
27
|
+
return __callAsync(arguments)
|
|
28
|
+
}
|
|
29
|
+
public borrowing func __nitroCallAndForget(_ arguments: Arguments) {
|
|
30
|
+
__callAndForget(arguments)
|
|
31
|
+
}
|
|
32
|
+
public init(_ closure: @escaping @Sendable (Bool) throws -> Return) {
|
|
33
|
+
self = bridge.create_Callback_void_bool(.init { (param0: Bool) -> bridge.Result_void in
|
|
34
|
+
do {
|
|
35
|
+
try closure(param0)
|
|
36
|
+
return bridge.Result_void.withValue()
|
|
37
|
+
} catch {
|
|
38
|
+
return bridge.Result_void.withError(error.toCpp())
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
extension Callback<(Bool), Void> where Self == Callback_void_bool {
|
|
45
|
+
/// Creates a native callback from an escaping Swift closure.
|
|
46
|
+
public static func native(_ closure: @escaping @Sendable (Bool) throws -> Void) -> Self {
|
|
47
|
+
return Self(closure)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
extension Callback<(Bool), Void> {
|
|
52
|
+
func toCpp() -> Callback_void_bool {
|
|
53
|
+
if let value = self as? Callback_void_bool {
|
|
54
|
+
return value
|
|
55
|
+
}
|
|
56
|
+
return Callback_void_bool { (param0: Bool) -> Void in
|
|
57
|
+
try self.callSync((param0))
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CoverRequest.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
internal import NitroModules
|
|
9
|
+
internal import CxxStdlib
|
|
10
|
+
|
|
11
|
+
@_expose(Cxx)
|
|
12
|
+
public struct CoverRequest: Equatable, Hashable, Sendable {
|
|
13
|
+
public let style: ThemeTransitionStyle
|
|
14
|
+
public let durationMs: Double
|
|
15
|
+
public let originX: Double?
|
|
16
|
+
public let originY: Double?
|
|
17
|
+
public let direction: ThemeTransitionDirection?
|
|
18
|
+
|
|
19
|
+
public init(style: ThemeTransitionStyle, durationMs: Double, originX: Double?, originY: Double?, direction: ThemeTransitionDirection?) {
|
|
20
|
+
self.style = style
|
|
21
|
+
self.durationMs = durationMs
|
|
22
|
+
self.originX = originX
|
|
23
|
+
self.originY = originY
|
|
24
|
+
self.direction = direction
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@_spi(NitroCxx)
|
|
28
|
+
public static func init_cxx(_ style: ThemeTransitionStyle, _ durationMs: Double, _ originX: Double?, _ originY: Double?, _ direction: ThemeTransitionDirection?) -> Self {
|
|
29
|
+
return Self(style: style, durationMs: durationMs, originX: originX, originY: originY, direction: direction)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@_spi(NitroCxx)
|
|
33
|
+
public borrowing func getStyle_cxx() -> ThemeTransitionStyle {
|
|
34
|
+
return self.style
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@_spi(NitroCxx)
|
|
38
|
+
public borrowing func getDurationMs_cxx() -> Double {
|
|
39
|
+
return self.durationMs
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@_spi(NitroCxx)
|
|
43
|
+
public borrowing func getOriginX_cxx() -> Double? {
|
|
44
|
+
return self.originX
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@_spi(NitroCxx)
|
|
48
|
+
public borrowing func getOriginY_cxx() -> Double? {
|
|
49
|
+
return self.originY
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@_spi(NitroCxx)
|
|
53
|
+
public borrowing func getDirection_cxx() -> ThemeTransitionDirection? {
|
|
54
|
+
return self.direction
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReducedMotionSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
public import NitroModules
|
|
9
|
+
|
|
10
|
+
/// See ``HybridReducedMotionSpec``
|
|
11
|
+
public protocol HybridReducedMotionSpec_protocol: HybridReducedMotionSpec_base, HybridObject {
|
|
12
|
+
// Constructor
|
|
13
|
+
init() throws
|
|
14
|
+
|
|
15
|
+
// Properties
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
// Methods
|
|
19
|
+
func isReducedMotionEnabled() throws -> Bool
|
|
20
|
+
func addOnReducedMotionChangedListener(listener: any Callback<(/* reducedMotion */ Bool), Void>) throws -> ListenerSubscription
|
|
21
|
+
|
|
22
|
+
// Static Properties
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
// Static Methods
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public extension HybridReducedMotionSpec_protocol {
|
|
30
|
+
/// Default implementation of ``HybridObject.toString``
|
|
31
|
+
func toString() -> String {
|
|
32
|
+
return "[HybridObject ReducedMotion]"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/// See ``HybridReducedMotionSpec``
|
|
37
|
+
open class HybridReducedMotionSpec_base {
|
|
38
|
+
private weak var cxxWrapper: HybridReducedMotionSpec_cxx? = nil
|
|
39
|
+
public init() throws {
|
|
40
|
+
}
|
|
41
|
+
public final func getCxxWrapper() -> HybridReducedMotionSpec_cxx {
|
|
42
|
+
#if DEBUG
|
|
43
|
+
guard self is any HybridReducedMotionSpec else {
|
|
44
|
+
fatalError("`self` is not a `HybridReducedMotionSpec`! Did you accidentally inherit from `HybridReducedMotionSpec_base` instead of `HybridReducedMotionSpec`?")
|
|
45
|
+
}
|
|
46
|
+
#endif
|
|
47
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
48
|
+
return cxxWrapper
|
|
49
|
+
} else {
|
|
50
|
+
let cxxWrapper = HybridReducedMotionSpec_cxx(self as! any HybridReducedMotionSpec)
|
|
51
|
+
self.cxxWrapper = cxxWrapper
|
|
52
|
+
return cxxWrapper
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A Swift base-protocol representing the ReducedMotion HybridObject.
|
|
59
|
+
* Implement this protocol to create Swift-based instances of ReducedMotion.
|
|
60
|
+
* ```swift
|
|
61
|
+
* class HybridReducedMotion : HybridReducedMotionSpec {
|
|
62
|
+
* // ...
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
public typealias HybridReducedMotionSpec = HybridReducedMotionSpec_protocol & HybridReducedMotionSpec_base
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridReducedMotionSpec_cxx.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
internal import NitroModules
|
|
8
|
+
internal import CxxStdlib
|
|
9
|
+
internal import NitroWindNativeAppleCxx
|
|
10
|
+
internal import NitroModulesAppleCxx
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A class implementation that bridges HybridReducedMotionSpec over to C++.
|
|
14
|
+
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
15
|
+
*/
|
|
16
|
+
@_expose(Cxx)
|
|
17
|
+
public final class HybridReducedMotionSpec_cxx {
|
|
18
|
+
/**
|
|
19
|
+
* The Swift <> C++ bridge's namespace (`margelo::nitro::nitrowind::swift_bridge`)
|
|
20
|
+
* from `NitroWindNativeAppleCxx/NitroWindNativeAppleCxx.h`.
|
|
21
|
+
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
22
|
+
*/
|
|
23
|
+
public typealias bridge = margelo.nitro.nitrowind.swift_bridge
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Holds the Swift implementation of `HybridReducedMotionSpec`.
|
|
27
|
+
*/
|
|
28
|
+
private let __implementation: HybridReducedMotion
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
32
|
+
*/
|
|
33
|
+
private var __cxxPart: bridge.std__weak_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_ = .init()
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Create a new `HybridReducedMotionSpec_cxx` that wraps the given `HybridReducedMotionSpec`.
|
|
37
|
+
*/
|
|
38
|
+
public init(_ implementation: any HybridReducedMotionSpec) {
|
|
39
|
+
guard let implementation = implementation as? HybridReducedMotion else {
|
|
40
|
+
preconditionFailure("ReducedMotion selects HybridReducedMotion as its Swift implementation. Every instance must inherit HybridReducedMotion.")
|
|
41
|
+
}
|
|
42
|
+
self.__implementation = implementation
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Get the actual `HybridReducedMotionSpec` instance this class wraps.
|
|
48
|
+
*/
|
|
49
|
+
@inline(__always)
|
|
50
|
+
public func getHybridReducedMotionSpec() -> any HybridReducedMotionSpec {
|
|
51
|
+
return __implementation
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
56
|
+
* This acquires one additional strong reference on the object!
|
|
57
|
+
*/
|
|
58
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
59
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Casts an unsafe pointer to a `HybridReducedMotionSpec_cxx`.
|
|
64
|
+
* The pointer has to be a retained opaque `Unmanaged<HybridReducedMotionSpec_cxx>`.
|
|
65
|
+
* This removes one strong reference from the object!
|
|
66
|
+
*/
|
|
67
|
+
public class func fromUnsafe(pointer: UnsafeMutableRawPointer) -> HybridReducedMotionSpec_cxx {
|
|
68
|
+
return Unmanaged<HybridReducedMotionSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
73
|
+
* This handle keeps the original native object alive.
|
|
74
|
+
*/
|
|
75
|
+
public func getCxxPart() -> bridge.std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_ {
|
|
76
|
+
let cached = __cxxPart.lock()
|
|
77
|
+
if cached.use_count() > 0 {
|
|
78
|
+
return cached
|
|
79
|
+
}
|
|
80
|
+
let value = bridge.create_std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_(self.toUnsafe())
|
|
81
|
+
__cxxPart = bridge.weakify_std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_(value)
|
|
82
|
+
return value
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
// A static borrowing accessor lets C++ pass a const reference without copying it.
|
|
88
|
+
// TODO: Remove this adapter and call the instance method directly once
|
|
89
|
+
// https://github.com/swiftlang/swift/pull/92862 is merged and supported by our Swift toolchain.
|
|
90
|
+
@_spi(NitroCxx)
|
|
91
|
+
public static func getCxxPart(_ value: borrowing HybridReducedMotionSpec_cxx) -> bridge.std__shared_ptr_margelo__nitro__nitrowind__HybridReducedMotionSpec_ {
|
|
92
|
+
return value.getCxxPart()
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
97
|
+
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
98
|
+
*/
|
|
99
|
+
@inline(__always)
|
|
100
|
+
public var memorySize: Int {
|
|
101
|
+
return MemoryHelper.getSizeOf(__implementation) + __implementation.memorySize
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Compares this object with the given [other] object for reference equality.
|
|
106
|
+
*/
|
|
107
|
+
@inline(__always)
|
|
108
|
+
public func equals(other: HybridReducedMotionSpec_cxx) -> Bool {
|
|
109
|
+
return __implementation === other.__implementation
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Call dispose() on the Swift class.
|
|
114
|
+
* This _may_ be called manually from JS.
|
|
115
|
+
*/
|
|
116
|
+
@inline(__always)
|
|
117
|
+
public func dispose() {
|
|
118
|
+
__implementation.dispose()
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Call toString() on the Swift class.
|
|
123
|
+
*/
|
|
124
|
+
@inline(__always)
|
|
125
|
+
public func toString() -> String {
|
|
126
|
+
return __implementation.toString()
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Properties
|
|
130
|
+
|
|
131
|
+
// Methods
|
|
132
|
+
|
|
133
|
+
public final func isReducedMotionEnabled() -> bridge.Result_bool {
|
|
134
|
+
do {
|
|
135
|
+
let value = try __implementation.isReducedMotionEnabled()
|
|
136
|
+
return bridge.Result_bool.withValue(value)
|
|
137
|
+
} catch {
|
|
138
|
+
return bridge.Result_bool.withError(error.toCpp())
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
public final func addOnReducedMotionChangedListener(listener: UnsafeRawPointer, __onResult: UnsafeRawPointer) -> bridge.Result_void {
|
|
143
|
+
do {
|
|
144
|
+
let value = try __implementation.addOnReducedMotionChangedListener(listener: listener.load(as: margelo.nitro.nitrowind.swift_bridge.Callback_void_bool.self))
|
|
145
|
+
withUnsafePointer(to: value) { pointer in
|
|
146
|
+
margelo.nitro.SwiftResultConsumer.consume(__onResult, UnsafeRawPointer(pointer))
|
|
147
|
+
}
|
|
148
|
+
return bridge.Result_void.withValue()
|
|
149
|
+
} catch {
|
|
150
|
+
return bridge.Result_void.withError(error.toCpp())
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Constructor
|
|
155
|
+
|
|
156
|
+
public class func constructor() -> bridge.Result_void_ {
|
|
157
|
+
do {
|
|
158
|
+
let value = try HybridReducedMotion()
|
|
159
|
+
return bridge.Result_void_.withValue(value.getCxxWrapper().toUnsafe())
|
|
160
|
+
} catch {
|
|
161
|
+
return bridge.Result_void_.withError(error.toCpp())
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridThemeCoverSpec.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
public import NitroModules
|
|
9
|
+
|
|
10
|
+
/// See ``HybridThemeCoverSpec``
|
|
11
|
+
public protocol HybridThemeCoverSpec_protocol: HybridThemeCoverSpec_base, HybridObject {
|
|
12
|
+
// Constructor
|
|
13
|
+
init() throws
|
|
14
|
+
|
|
15
|
+
// Properties
|
|
16
|
+
var isSyncCaptureSupported: Bool { get }
|
|
17
|
+
|
|
18
|
+
// Methods
|
|
19
|
+
func captureCoverSync(request: CoverRequest) throws -> Bool
|
|
20
|
+
func captureCoverAsync(request: CoverRequest) throws -> any Promise<Bool>
|
|
21
|
+
func finishCover() throws -> any Promise<Void>
|
|
22
|
+
func cancelCover() throws -> Void
|
|
23
|
+
func isCoverActive() throws -> Bool
|
|
24
|
+
func lastCaptureOutcome() throws -> String
|
|
25
|
+
|
|
26
|
+
// Static Properties
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
// Static Methods
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public extension HybridThemeCoverSpec_protocol {
|
|
34
|
+
/// Default implementation of ``HybridObject.toString``
|
|
35
|
+
func toString() -> String {
|
|
36
|
+
return "[HybridObject ThemeCover]"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/// See ``HybridThemeCoverSpec``
|
|
41
|
+
open class HybridThemeCoverSpec_base {
|
|
42
|
+
private weak var cxxWrapper: HybridThemeCoverSpec_cxx? = nil
|
|
43
|
+
public init() throws {
|
|
44
|
+
}
|
|
45
|
+
public final func getCxxWrapper() -> HybridThemeCoverSpec_cxx {
|
|
46
|
+
#if DEBUG
|
|
47
|
+
guard self is any HybridThemeCoverSpec else {
|
|
48
|
+
fatalError("`self` is not a `HybridThemeCoverSpec`! Did you accidentally inherit from `HybridThemeCoverSpec_base` instead of `HybridThemeCoverSpec`?")
|
|
49
|
+
}
|
|
50
|
+
#endif
|
|
51
|
+
if let cxxWrapper = self.cxxWrapper {
|
|
52
|
+
return cxxWrapper
|
|
53
|
+
} else {
|
|
54
|
+
let cxxWrapper = HybridThemeCoverSpec_cxx(self as! any HybridThemeCoverSpec)
|
|
55
|
+
self.cxxWrapper = cxxWrapper
|
|
56
|
+
return cxxWrapper
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A Swift base-protocol representing the ThemeCover HybridObject.
|
|
63
|
+
* Implement this protocol to create Swift-based instances of ThemeCover.
|
|
64
|
+
* ```swift
|
|
65
|
+
* class HybridThemeCover : HybridThemeCoverSpec {
|
|
66
|
+
* // ...
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
public typealias HybridThemeCoverSpec = HybridThemeCoverSpec_protocol & HybridThemeCoverSpec_base
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridThemeCoverSpec_cxx.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/margelo/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
internal import NitroModules
|
|
8
|
+
internal import CxxStdlib
|
|
9
|
+
internal import NitroWindNativeAppleCxx
|
|
10
|
+
internal import NitroModulesAppleCxx
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A class implementation that bridges HybridThemeCoverSpec over to C++.
|
|
14
|
+
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
15
|
+
*/
|
|
16
|
+
@_expose(Cxx)
|
|
17
|
+
public final class HybridThemeCoverSpec_cxx {
|
|
18
|
+
/**
|
|
19
|
+
* The Swift <> C++ bridge's namespace (`margelo::nitro::nitrowind::swift_bridge`)
|
|
20
|
+
* from `NitroWindNativeAppleCxx/NitroWindNativeAppleCxx.h`.
|
|
21
|
+
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
22
|
+
*/
|
|
23
|
+
public typealias bridge = margelo.nitro.nitrowind.swift_bridge
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Holds the Swift implementation of `HybridThemeCoverSpec`.
|
|
27
|
+
*/
|
|
28
|
+
private let __implementation: HybridThemeCover
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
32
|
+
*/
|
|
33
|
+
private var __cxxPart: bridge.std__weak_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_ = .init()
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Create a new `HybridThemeCoverSpec_cxx` that wraps the given `HybridThemeCoverSpec`.
|
|
37
|
+
*/
|
|
38
|
+
public init(_ implementation: any HybridThemeCoverSpec) {
|
|
39
|
+
guard let implementation = implementation as? HybridThemeCover else {
|
|
40
|
+
preconditionFailure("ThemeCover selects HybridThemeCover as its Swift implementation. Every instance must inherit HybridThemeCover.")
|
|
41
|
+
}
|
|
42
|
+
self.__implementation = implementation
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Get the actual `HybridThemeCoverSpec` instance this class wraps.
|
|
48
|
+
*/
|
|
49
|
+
@inline(__always)
|
|
50
|
+
public func getHybridThemeCoverSpec() -> any HybridThemeCoverSpec {
|
|
51
|
+
return __implementation
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
56
|
+
* This acquires one additional strong reference on the object!
|
|
57
|
+
*/
|
|
58
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
59
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Casts an unsafe pointer to a `HybridThemeCoverSpec_cxx`.
|
|
64
|
+
* The pointer has to be a retained opaque `Unmanaged<HybridThemeCoverSpec_cxx>`.
|
|
65
|
+
* This removes one strong reference from the object!
|
|
66
|
+
*/
|
|
67
|
+
public class func fromUnsafe(pointer: UnsafeMutableRawPointer) -> HybridThemeCoverSpec_cxx {
|
|
68
|
+
return Unmanaged<HybridThemeCoverSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
73
|
+
* This handle keeps the original native object alive.
|
|
74
|
+
*/
|
|
75
|
+
public func getCxxPart() -> bridge.std__shared_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_ {
|
|
76
|
+
let cached = __cxxPart.lock()
|
|
77
|
+
if cached.use_count() > 0 {
|
|
78
|
+
return cached
|
|
79
|
+
}
|
|
80
|
+
let value = bridge.create_std__shared_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_(self.toUnsafe())
|
|
81
|
+
__cxxPart = bridge.weakify_std__shared_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_(value)
|
|
82
|
+
return value
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
// A static borrowing accessor lets C++ pass a const reference without copying it.
|
|
88
|
+
// TODO: Remove this adapter and call the instance method directly once
|
|
89
|
+
// https://github.com/swiftlang/swift/pull/92862 is merged and supported by our Swift toolchain.
|
|
90
|
+
@_spi(NitroCxx)
|
|
91
|
+
public static func getCxxPart(_ value: borrowing HybridThemeCoverSpec_cxx) -> bridge.std__shared_ptr_margelo__nitro__nitrowind__HybridThemeCoverSpec_ {
|
|
92
|
+
return value.getCxxPart()
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
97
|
+
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
98
|
+
*/
|
|
99
|
+
@inline(__always)
|
|
100
|
+
public var memorySize: Int {
|
|
101
|
+
return MemoryHelper.getSizeOf(__implementation) + __implementation.memorySize
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Compares this object with the given [other] object for reference equality.
|
|
106
|
+
*/
|
|
107
|
+
@inline(__always)
|
|
108
|
+
public func equals(other: HybridThemeCoverSpec_cxx) -> Bool {
|
|
109
|
+
return __implementation === other.__implementation
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Call dispose() on the Swift class.
|
|
114
|
+
* This _may_ be called manually from JS.
|
|
115
|
+
*/
|
|
116
|
+
@inline(__always)
|
|
117
|
+
public func dispose() {
|
|
118
|
+
__implementation.dispose()
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Call toString() on the Swift class.
|
|
123
|
+
*/
|
|
124
|
+
@inline(__always)
|
|
125
|
+
public func toString() -> String {
|
|
126
|
+
return __implementation.toString()
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Properties
|
|
130
|
+
|
|
131
|
+
public final func getIsSyncCaptureSupported() -> Bool {
|
|
132
|
+
let value = __implementation.isSyncCaptureSupported
|
|
133
|
+
return value
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Methods
|
|
137
|
+
|
|
138
|
+
public final func captureCoverSync(request: CoverRequest) -> bridge.Result_bool {
|
|
139
|
+
do {
|
|
140
|
+
let value = try __implementation.captureCoverSync(request: request)
|
|
141
|
+
return bridge.Result_bool.withValue(value)
|
|
142
|
+
} catch {
|
|
143
|
+
return bridge.Result_bool.withError(error.toCpp())
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
public final func captureCoverAsync(request: CoverRequest, __outResult: UnsafeMutableRawPointer) -> bridge.Result_void {
|
|
148
|
+
do {
|
|
149
|
+
let value = try __implementation.captureCoverAsync(request: request)
|
|
150
|
+
__outResult.initializeMemory(as: margelo.nitro.nitrowind.swift_bridge.Promise_bool.self, repeating: value.toCpp(), count: 1)
|
|
151
|
+
return bridge.Result_void.withValue()
|
|
152
|
+
} catch {
|
|
153
|
+
return bridge.Result_void.withError(error.toCpp())
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
public final func finishCover(__outResult: UnsafeMutableRawPointer) -> bridge.Result_void {
|
|
158
|
+
do {
|
|
159
|
+
let value = try __implementation.finishCover()
|
|
160
|
+
__outResult.initializeMemory(as: margelo.nitro.nitrowind.swift_bridge.Promise_void.self, repeating: value.toCpp(), count: 1)
|
|
161
|
+
return bridge.Result_void.withValue()
|
|
162
|
+
} catch {
|
|
163
|
+
return bridge.Result_void.withError(error.toCpp())
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
public final func cancelCover() -> bridge.Result_void {
|
|
168
|
+
do {
|
|
169
|
+
try __implementation.cancelCover()
|
|
170
|
+
return bridge.Result_void.withValue()
|
|
171
|
+
} catch {
|
|
172
|
+
return bridge.Result_void.withError(error.toCpp())
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
public final func isCoverActive() -> bridge.Result_bool {
|
|
177
|
+
do {
|
|
178
|
+
let value = try __implementation.isCoverActive()
|
|
179
|
+
return bridge.Result_bool.withValue(value)
|
|
180
|
+
} catch {
|
|
181
|
+
return bridge.Result_bool.withError(error.toCpp())
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
public final func lastCaptureOutcome(__onResult: UnsafeRawPointer) -> bridge.Result_void {
|
|
186
|
+
do {
|
|
187
|
+
let value = try __implementation.lastCaptureOutcome()
|
|
188
|
+
withUnsafePointer(to: value) { pointer in
|
|
189
|
+
margelo.nitro.SwiftResultConsumer.consume(__onResult, UnsafeRawPointer(pointer))
|
|
190
|
+
}
|
|
191
|
+
return bridge.Result_void.withValue()
|
|
192
|
+
} catch {
|
|
193
|
+
return bridge.Result_void.withError(error.toCpp())
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Constructor
|
|
198
|
+
|
|
199
|
+
public class func constructor() -> bridge.Result_void_ {
|
|
200
|
+
do {
|
|
201
|
+
let value = try HybridThemeCover()
|
|
202
|
+
return bridge.Result_void_.withValue(value.getCxxWrapper().toUnsafe())
|
|
203
|
+
} catch {
|
|
204
|
+
return bridge.Result_void_.withError(error.toCpp())
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|