@kingstinct/react-native-healthkit 9.0.7 → 9.0.9
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/ios/CategoryTypeModule.swift +18 -21
- package/ios/CorrelationTypeModule.swift +18 -18
- package/ios/HeartbeatSeriesModule.swift +32 -32
- package/ios/QuantityTypeModule.swift +71 -59
- package/ios/Serializers.swift +12 -16
- package/ios/StateOfMindModule.swift +17 -17
- package/ios/WorkoutsModule.swift +59 -110
- package/lib/commonjs/healthkit.js +1 -1
- package/lib/module/healthkit.js +1 -1
- package/lib/typescript/healthkit.d.ts +3 -2
- package/lib/typescript/specs/WorkoutsModule.nitro.d.ts +3 -0
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.cpp +3 -44
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +24 -124
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp +0 -14
- package/package.json +2 -2
- package/src/healthkit.ts +2 -0
- package/src/specs/WorkoutsModule.nitro.ts +3 -0
- package/ios/WorkoutSessionModule.swift +0 -182
- package/lib/commonjs/specs/WorkoutSessionModule.nitro.js +0 -19
- package/lib/module/specs/WorkoutSessionModule.nitro.js +0 -16
- package/lib/typescript/specs/WorkoutSessionModule.nitro.d.ts +0 -47
- package/nitrogen/generated/ios/c++/HybridWorkoutSessionModuleSpecSwift.cpp +0 -11
- package/nitrogen/generated/ios/c++/HybridWorkoutSessionModuleSpecSwift.hpp +0 -107
- package/nitrogen/generated/ios/swift/Func_void_WorkoutEventType.swift +0 -46
- package/nitrogen/generated/ios/swift/Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point.swift +0 -46
- package/nitrogen/generated/ios/swift/Func_void_std__vector_RemoteSessionSharableData_.swift +0 -46
- package/nitrogen/generated/ios/swift/HybridWorkoutSessionModuleSpec.swift +0 -49
- package/nitrogen/generated/ios/swift/HybridWorkoutSessionModuleSpec_cxx.swift +0 -133
- package/nitrogen/generated/ios/swift/RemoteSessionSharableData.swift +0 -46
- package/nitrogen/generated/ios/swift/WorkoutSessionMirroringStartHandlerOptions.swift +0 -118
- package/nitrogen/generated/ios/swift/WorkoutSessionState.swift +0 -56
- package/nitrogen/generated/shared/c++/HybridWorkoutSessionModuleSpec.cpp +0 -22
- package/nitrogen/generated/shared/c++/HybridWorkoutSessionModuleSpec.hpp +0 -68
- package/nitrogen/generated/shared/c++/RemoteSessionSharableData.hpp +0 -75
- package/nitrogen/generated/shared/c++/WorkoutSessionMirroringStartHandlerOptions.hpp +0 -92
- package/nitrogen/generated/shared/c++/WorkoutSessionState.hpp +0 -68
- package/src/specs/WorkoutSessionModule.nitro.ts +0 -71
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridWorkoutSessionModuleSpecSwift.hpp
|
|
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
|
-
#pragma once
|
|
9
|
-
|
|
10
|
-
#include "HybridWorkoutSessionModuleSpec.hpp"
|
|
11
|
-
|
|
12
|
-
// Forward declaration of `HybridWorkoutSessionModuleSpec_cxx` to properly resolve imports.
|
|
13
|
-
namespace ReactNativeHealthkit { class HybridWorkoutSessionModuleSpec_cxx; }
|
|
14
|
-
|
|
15
|
-
// Forward declaration of `WorkoutConfiguration` to properly resolve imports.
|
|
16
|
-
namespace margelo::nitro::healthkit { struct WorkoutConfiguration; }
|
|
17
|
-
// Forward declaration of `WorkoutActivityType` to properly resolve imports.
|
|
18
|
-
namespace margelo::nitro::healthkit { enum class WorkoutActivityType; }
|
|
19
|
-
// Forward declaration of `WorkoutSessionLocationType` to properly resolve imports.
|
|
20
|
-
namespace margelo::nitro::healthkit { enum class WorkoutSessionLocationType; }
|
|
21
|
-
// Forward declaration of `WorkoutSessionMirroringStartHandlerOptions` to properly resolve imports.
|
|
22
|
-
namespace margelo::nitro::healthkit { struct WorkoutSessionMirroringStartHandlerOptions; }
|
|
23
|
-
// Forward declaration of `WorkoutSessionState` to properly resolve imports.
|
|
24
|
-
namespace margelo::nitro::healthkit { enum class WorkoutSessionState; }
|
|
25
|
-
// Forward declaration of `RemoteSessionSharableData` to properly resolve imports.
|
|
26
|
-
namespace margelo::nitro::healthkit { struct RemoteSessionSharableData; }
|
|
27
|
-
// Forward declaration of `AnyMap` to properly resolve imports.
|
|
28
|
-
namespace NitroModules { class AnyMap; }
|
|
29
|
-
// Forward declaration of `WorkoutEventType` to properly resolve imports.
|
|
30
|
-
namespace margelo::nitro::healthkit { enum class WorkoutEventType; }
|
|
31
|
-
|
|
32
|
-
#include <NitroModules/Promise.hpp>
|
|
33
|
-
#include "WorkoutConfiguration.hpp"
|
|
34
|
-
#include "WorkoutActivityType.hpp"
|
|
35
|
-
#include <optional>
|
|
36
|
-
#include "WorkoutSessionLocationType.hpp"
|
|
37
|
-
#include "WorkoutSessionMirroringStartHandlerOptions.hpp"
|
|
38
|
-
#include <functional>
|
|
39
|
-
#include <string>
|
|
40
|
-
#include "WorkoutSessionState.hpp"
|
|
41
|
-
#include <chrono>
|
|
42
|
-
#include <vector>
|
|
43
|
-
#include "RemoteSessionSharableData.hpp"
|
|
44
|
-
#include <NitroModules/AnyMap.hpp>
|
|
45
|
-
#include "WorkoutEventType.hpp"
|
|
46
|
-
|
|
47
|
-
#include "ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp"
|
|
48
|
-
|
|
49
|
-
namespace margelo::nitro::healthkit {
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* The C++ part of HybridWorkoutSessionModuleSpec_cxx.swift.
|
|
53
|
-
*
|
|
54
|
-
* HybridWorkoutSessionModuleSpecSwift (C++) accesses HybridWorkoutSessionModuleSpec_cxx (Swift), and might
|
|
55
|
-
* contain some additional bridging code for C++ <> Swift interop.
|
|
56
|
-
*
|
|
57
|
-
* Since this obviously introduces an overhead, I hope at some point in
|
|
58
|
-
* the future, HybridWorkoutSessionModuleSpec_cxx can directly inherit from the C++ class HybridWorkoutSessionModuleSpec
|
|
59
|
-
* to simplify the whole structure and memory management.
|
|
60
|
-
*/
|
|
61
|
-
class HybridWorkoutSessionModuleSpecSwift: public virtual HybridWorkoutSessionModuleSpec {
|
|
62
|
-
public:
|
|
63
|
-
// Constructor from a Swift instance
|
|
64
|
-
explicit HybridWorkoutSessionModuleSpecSwift(const ReactNativeHealthkit::HybridWorkoutSessionModuleSpec_cxx& swiftPart):
|
|
65
|
-
HybridObject(HybridWorkoutSessionModuleSpec::TAG),
|
|
66
|
-
_swiftPart(swiftPart) { }
|
|
67
|
-
|
|
68
|
-
public:
|
|
69
|
-
// Get the Swift part
|
|
70
|
-
inline ReactNativeHealthkit::HybridWorkoutSessionModuleSpec_cxx& getSwiftPart() noexcept {
|
|
71
|
-
return _swiftPart;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public:
|
|
75
|
-
// Get memory pressure
|
|
76
|
-
inline size_t getExternalMemorySize() noexcept override {
|
|
77
|
-
return _swiftPart.getMemorySize();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public:
|
|
81
|
-
// Properties
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
public:
|
|
85
|
-
// Methods
|
|
86
|
-
inline std::shared_ptr<Promise<bool>> startWatchAppWithWorkoutConfiguration(const WorkoutConfiguration& workoutConfiguration) override {
|
|
87
|
-
auto __result = _swiftPart.startWatchAppWithWorkoutConfiguration(workoutConfiguration);
|
|
88
|
-
if (__result.hasError()) [[unlikely]] {
|
|
89
|
-
std::rethrow_exception(__result.error());
|
|
90
|
-
}
|
|
91
|
-
auto __value = std::move(__result.value());
|
|
92
|
-
return __value;
|
|
93
|
-
}
|
|
94
|
-
inline bool workoutSessionMirroringStartHandler(const WorkoutSessionMirroringStartHandlerOptions& options) override {
|
|
95
|
-
auto __result = _swiftPart.workoutSessionMirroringStartHandler(options);
|
|
96
|
-
if (__result.hasError()) [[unlikely]] {
|
|
97
|
-
std::rethrow_exception(__result.error());
|
|
98
|
-
}
|
|
99
|
-
auto __value = std::move(__result.value());
|
|
100
|
-
return __value;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
private:
|
|
104
|
-
ReactNativeHealthkit::HybridWorkoutSessionModuleSpec_cxx _swiftPart;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
} // namespace margelo::nitro::healthkit
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// Func_void_WorkoutEventType.swift
|
|
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
|
-
import NitroModules
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Wraps a Swift `(_ type: WorkoutEventType) -> Void` as a class.
|
|
12
|
-
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
-
*/
|
|
14
|
-
public final class Func_void_WorkoutEventType {
|
|
15
|
-
public typealias bridge = margelo.nitro.healthkit.bridge.swift
|
|
16
|
-
|
|
17
|
-
private let closure: (_ type: WorkoutEventType) -> Void
|
|
18
|
-
|
|
19
|
-
public init(_ closure: @escaping (_ type: WorkoutEventType) -> Void) {
|
|
20
|
-
self.closure = closure
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@inline(__always)
|
|
24
|
-
public func call(type: Int32) -> Void {
|
|
25
|
-
self.closure(margelo.nitro.healthkit.WorkoutEventType(rawValue: type)!)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
-
* This acquires one additional strong reference on the object!
|
|
31
|
-
*/
|
|
32
|
-
@inline(__always)
|
|
33
|
-
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
-
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Casts an unsafe pointer to a `Func_void_WorkoutEventType`.
|
|
39
|
-
* The pointer has to be a retained opaque `Unmanaged<Func_void_WorkoutEventType>`.
|
|
40
|
-
* This removes one strong reference from the object!
|
|
41
|
-
*/
|
|
42
|
-
@inline(__always)
|
|
43
|
-
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_WorkoutEventType {
|
|
44
|
-
return Unmanaged<Func_void_WorkoutEventType>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point.swift
|
|
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
|
-
import NitroModules
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Wraps a Swift `(_ toState: WorkoutSessionState, _ fromState: WorkoutSessionState, _ date: Date) -> Void` as a class.
|
|
12
|
-
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
-
*/
|
|
14
|
-
public final class Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point {
|
|
15
|
-
public typealias bridge = margelo.nitro.healthkit.bridge.swift
|
|
16
|
-
|
|
17
|
-
private let closure: (_ toState: WorkoutSessionState, _ fromState: WorkoutSessionState, _ date: Date) -> Void
|
|
18
|
-
|
|
19
|
-
public init(_ closure: @escaping (_ toState: WorkoutSessionState, _ fromState: WorkoutSessionState, _ date: Date) -> Void) {
|
|
20
|
-
self.closure = closure
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@inline(__always)
|
|
24
|
-
public func call(toState: Int32, fromState: Int32, date: margelo.nitro.chrono_time) -> Void {
|
|
25
|
-
self.closure(margelo.nitro.healthkit.WorkoutSessionState(rawValue: toState)!, margelo.nitro.healthkit.WorkoutSessionState(rawValue: fromState)!, Date(fromChrono: date))
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
-
* This acquires one additional strong reference on the object!
|
|
31
|
-
*/
|
|
32
|
-
@inline(__always)
|
|
33
|
-
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
-
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Casts an unsafe pointer to a `Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point`.
|
|
39
|
-
* The pointer has to be a retained opaque `Unmanaged<Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point>`.
|
|
40
|
-
* This removes one strong reference from the object!
|
|
41
|
-
*/
|
|
42
|
-
@inline(__always)
|
|
43
|
-
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point {
|
|
44
|
-
return Unmanaged<Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// Func_void_std__vector_RemoteSessionSharableData_.swift
|
|
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
|
-
import NitroModules
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Wraps a Swift `(_ data: [RemoteSessionSharableData]) -> Void` as a class.
|
|
12
|
-
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
-
*/
|
|
14
|
-
public final class Func_void_std__vector_RemoteSessionSharableData_ {
|
|
15
|
-
public typealias bridge = margelo.nitro.healthkit.bridge.swift
|
|
16
|
-
|
|
17
|
-
private let closure: (_ data: [RemoteSessionSharableData]) -> Void
|
|
18
|
-
|
|
19
|
-
public init(_ closure: @escaping (_ data: [RemoteSessionSharableData]) -> Void) {
|
|
20
|
-
self.closure = closure
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@inline(__always)
|
|
24
|
-
public func call(data: bridge.std__vector_RemoteSessionSharableData_) -> Void {
|
|
25
|
-
self.closure(data.map({ __item in __item }))
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
-
* This acquires one additional strong reference on the object!
|
|
31
|
-
*/
|
|
32
|
-
@inline(__always)
|
|
33
|
-
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
-
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Casts an unsafe pointer to a `Func_void_std__vector_RemoteSessionSharableData_`.
|
|
39
|
-
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_RemoteSessionSharableData_>`.
|
|
40
|
-
* This removes one strong reference from the object!
|
|
41
|
-
*/
|
|
42
|
-
@inline(__always)
|
|
43
|
-
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_RemoteSessionSharableData_ {
|
|
44
|
-
return Unmanaged<Func_void_std__vector_RemoteSessionSharableData_>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridWorkoutSessionModuleSpec.swift
|
|
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
|
-
import Foundation
|
|
9
|
-
import NitroModules
|
|
10
|
-
|
|
11
|
-
/// See ``HybridWorkoutSessionModuleSpec``
|
|
12
|
-
public protocol HybridWorkoutSessionModuleSpec_protocol: HybridObject {
|
|
13
|
-
// Properties
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// Methods
|
|
17
|
-
func startWatchAppWithWorkoutConfiguration(workoutConfiguration: WorkoutConfiguration) throws -> Promise<Bool>
|
|
18
|
-
func workoutSessionMirroringStartHandler(options: WorkoutSessionMirroringStartHandlerOptions) throws -> Bool
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/// See ``HybridWorkoutSessionModuleSpec``
|
|
22
|
-
public class HybridWorkoutSessionModuleSpec_base {
|
|
23
|
-
private weak var cxxWrapper: HybridWorkoutSessionModuleSpec_cxx? = nil
|
|
24
|
-
public func getCxxWrapper() -> HybridWorkoutSessionModuleSpec_cxx {
|
|
25
|
-
#if DEBUG
|
|
26
|
-
guard self is HybridWorkoutSessionModuleSpec else {
|
|
27
|
-
fatalError("`self` is not a `HybridWorkoutSessionModuleSpec`! Did you accidentally inherit from `HybridWorkoutSessionModuleSpec_base` instead of `HybridWorkoutSessionModuleSpec`?")
|
|
28
|
-
}
|
|
29
|
-
#endif
|
|
30
|
-
if let cxxWrapper = self.cxxWrapper {
|
|
31
|
-
return cxxWrapper
|
|
32
|
-
} else {
|
|
33
|
-
let cxxWrapper = HybridWorkoutSessionModuleSpec_cxx(self as! HybridWorkoutSessionModuleSpec)
|
|
34
|
-
self.cxxWrapper = cxxWrapper
|
|
35
|
-
return cxxWrapper
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* A Swift base-protocol representing the WorkoutSessionModule HybridObject.
|
|
42
|
-
* Implement this protocol to create Swift-based instances of WorkoutSessionModule.
|
|
43
|
-
* ```swift
|
|
44
|
-
* class HybridWorkoutSessionModule : HybridWorkoutSessionModuleSpec {
|
|
45
|
-
* // ...
|
|
46
|
-
* }
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
public typealias HybridWorkoutSessionModuleSpec = HybridWorkoutSessionModuleSpec_protocol & HybridWorkoutSessionModuleSpec_base
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridWorkoutSessionModuleSpec_cxx.swift
|
|
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
|
-
import Foundation
|
|
9
|
-
import NitroModules
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* A class implementation that bridges HybridWorkoutSessionModuleSpec over to C++.
|
|
13
|
-
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
14
|
-
*
|
|
15
|
-
* Also, some Swift types need to be bridged with special handling:
|
|
16
|
-
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
17
|
-
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
18
|
-
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
19
|
-
*/
|
|
20
|
-
public class HybridWorkoutSessionModuleSpec_cxx {
|
|
21
|
-
/**
|
|
22
|
-
* The Swift <> C++ bridge's namespace (`margelo::nitro::healthkit::bridge::swift`)
|
|
23
|
-
* from `ReactNativeHealthkit-Swift-Cxx-Bridge.hpp`.
|
|
24
|
-
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
25
|
-
*/
|
|
26
|
-
public typealias bridge = margelo.nitro.healthkit.bridge.swift
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Holds an instance of the `HybridWorkoutSessionModuleSpec` Swift protocol.
|
|
30
|
-
*/
|
|
31
|
-
private var __implementation: any HybridWorkoutSessionModuleSpec
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
35
|
-
*/
|
|
36
|
-
private var __cxxPart: bridge.std__weak_ptr_margelo__nitro__healthkit__HybridWorkoutSessionModuleSpec_
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Create a new `HybridWorkoutSessionModuleSpec_cxx` that wraps the given `HybridWorkoutSessionModuleSpec`.
|
|
40
|
-
* All properties and methods bridge to C++ types.
|
|
41
|
-
*/
|
|
42
|
-
public init(_ implementation: any HybridWorkoutSessionModuleSpec) {
|
|
43
|
-
self.__implementation = implementation
|
|
44
|
-
self.__cxxPart = .init()
|
|
45
|
-
/* no base class */
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Get the actual `HybridWorkoutSessionModuleSpec` instance this class wraps.
|
|
50
|
-
*/
|
|
51
|
-
@inline(__always)
|
|
52
|
-
public func getHybridWorkoutSessionModuleSpec() -> any HybridWorkoutSessionModuleSpec {
|
|
53
|
-
return __implementation
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Casts this instance to a retained unsafe raw pointer.
|
|
58
|
-
* This acquires one additional strong reference on the object!
|
|
59
|
-
*/
|
|
60
|
-
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
61
|
-
return Unmanaged.passRetained(self).toOpaque()
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Casts an unsafe pointer to a `HybridWorkoutSessionModuleSpec_cxx`.
|
|
66
|
-
* The pointer has to be a retained opaque `Unmanaged<HybridWorkoutSessionModuleSpec_cxx>`.
|
|
67
|
-
* This removes one strong reference from the object!
|
|
68
|
-
*/
|
|
69
|
-
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridWorkoutSessionModuleSpec_cxx {
|
|
70
|
-
return Unmanaged<HybridWorkoutSessionModuleSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
75
|
-
* The C++ part is a `std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutSessionModuleSpec>`.
|
|
76
|
-
*/
|
|
77
|
-
public func getCxxPart() -> bridge.std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutSessionModuleSpec_ {
|
|
78
|
-
let cachedCxxPart = self.__cxxPart.lock()
|
|
79
|
-
if cachedCxxPart.__convertToBool() {
|
|
80
|
-
return cachedCxxPart
|
|
81
|
-
} else {
|
|
82
|
-
let newCxxPart = bridge.create_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutSessionModuleSpec_(self.toUnsafe())
|
|
83
|
-
__cxxPart = bridge.weakify_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutSessionModuleSpec_(newCxxPart)
|
|
84
|
-
return newCxxPart
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
92
|
-
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
93
|
-
*/
|
|
94
|
-
@inline(__always)
|
|
95
|
-
public var memorySize: Int {
|
|
96
|
-
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Properties
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// Methods
|
|
103
|
-
@inline(__always)
|
|
104
|
-
public final func startWatchAppWithWorkoutConfiguration(workoutConfiguration: WorkoutConfiguration) -> bridge.Result_std__shared_ptr_Promise_bool___ {
|
|
105
|
-
do {
|
|
106
|
-
let __result = try self.__implementation.startWatchAppWithWorkoutConfiguration(workoutConfiguration: workoutConfiguration)
|
|
107
|
-
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_bool__ in
|
|
108
|
-
let __promise = bridge.create_std__shared_ptr_Promise_bool__()
|
|
109
|
-
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_bool__(__promise)
|
|
110
|
-
__result
|
|
111
|
-
.then({ __result in __promiseHolder.resolve(__result) })
|
|
112
|
-
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
113
|
-
return __promise
|
|
114
|
-
}()
|
|
115
|
-
return bridge.create_Result_std__shared_ptr_Promise_bool___(__resultCpp)
|
|
116
|
-
} catch (let __error) {
|
|
117
|
-
let __exceptionPtr = __error.toCpp()
|
|
118
|
-
return bridge.create_Result_std__shared_ptr_Promise_bool___(__exceptionPtr)
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
@inline(__always)
|
|
123
|
-
public final func workoutSessionMirroringStartHandler(options: WorkoutSessionMirroringStartHandlerOptions) -> bridge.Result_bool_ {
|
|
124
|
-
do {
|
|
125
|
-
let __result = try self.__implementation.workoutSessionMirroringStartHandler(options: options)
|
|
126
|
-
let __resultCpp = __result
|
|
127
|
-
return bridge.create_Result_bool_(__resultCpp)
|
|
128
|
-
} catch (let __error) {
|
|
129
|
-
let __exceptionPtr = __error.toCpp()
|
|
130
|
-
return bridge.create_Result_bool_(__exceptionPtr)
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// RemoteSessionSharableData.swift
|
|
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
|
-
import NitroModules
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Represents an instance of `RemoteSessionSharableData`, backed by a C++ struct.
|
|
12
|
-
*/
|
|
13
|
-
public typealias RemoteSessionSharableData = margelo.nitro.healthkit.RemoteSessionSharableData
|
|
14
|
-
|
|
15
|
-
public extension RemoteSessionSharableData {
|
|
16
|
-
private typealias bridge = margelo.nitro.healthkit.bridge.swift
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Create a new instance of `RemoteSessionSharableData`.
|
|
20
|
-
*/
|
|
21
|
-
init(type: String, payload: AnyMapHolder) {
|
|
22
|
-
self.init(std.string(type), payload.cppPart)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
var type: String {
|
|
26
|
-
@inline(__always)
|
|
27
|
-
get {
|
|
28
|
-
return String(self.__type)
|
|
29
|
-
}
|
|
30
|
-
@inline(__always)
|
|
31
|
-
set {
|
|
32
|
-
self.__type = std.string(newValue)
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var payload: AnyMapHolder {
|
|
37
|
-
@inline(__always)
|
|
38
|
-
get {
|
|
39
|
-
return AnyMapHolder(withCppPart: self.__payload)
|
|
40
|
-
}
|
|
41
|
-
@inline(__always)
|
|
42
|
-
set {
|
|
43
|
-
self.__payload = newValue.cppPart
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// WorkoutSessionMirroringStartHandlerOptions.swift
|
|
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
|
-
import NitroModules
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Represents an instance of `WorkoutSessionMirroringStartHandlerOptions`, backed by a C++ struct.
|
|
12
|
-
*/
|
|
13
|
-
public typealias WorkoutSessionMirroringStartHandlerOptions = margelo.nitro.healthkit.WorkoutSessionMirroringStartHandlerOptions
|
|
14
|
-
|
|
15
|
-
public extension WorkoutSessionMirroringStartHandlerOptions {
|
|
16
|
-
private typealias bridge = margelo.nitro.healthkit.bridge.swift
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Create a new instance of `WorkoutSessionMirroringStartHandlerOptions`.
|
|
20
|
-
*/
|
|
21
|
-
init(onError: @escaping (_ errorMessage: String) -> Void, onStateChange: @escaping (_ toState: WorkoutSessionState, _ fromState: WorkoutSessionState, _ date: Date) -> Void, onDataReceived: @escaping (_ data: [RemoteSessionSharableData]) -> Void, onEventReceived: @escaping (_ type: WorkoutEventType) -> Void) {
|
|
22
|
-
self.init({ () -> bridge.Func_void_std__string in
|
|
23
|
-
let __closureWrapper = Func_void_std__string(onError)
|
|
24
|
-
return bridge.create_Func_void_std__string(__closureWrapper.toUnsafe())
|
|
25
|
-
}(), { () -> bridge.Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point in
|
|
26
|
-
let __closureWrapper = Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point(onStateChange)
|
|
27
|
-
return bridge.create_Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point(__closureWrapper.toUnsafe())
|
|
28
|
-
}(), { () -> bridge.Func_void_std__vector_RemoteSessionSharableData_ in
|
|
29
|
-
let __closureWrapper = Func_void_std__vector_RemoteSessionSharableData_(onDataReceived)
|
|
30
|
-
return bridge.create_Func_void_std__vector_RemoteSessionSharableData_(__closureWrapper.toUnsafe())
|
|
31
|
-
}(), { () -> bridge.Func_void_WorkoutEventType in
|
|
32
|
-
let __closureWrapper = Func_void_WorkoutEventType(onEventReceived)
|
|
33
|
-
return bridge.create_Func_void_WorkoutEventType(__closureWrapper.toUnsafe())
|
|
34
|
-
}())
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
var onError: (_ errorMessage: String) -> Void {
|
|
38
|
-
@inline(__always)
|
|
39
|
-
get {
|
|
40
|
-
return { () -> (String) -> Void in
|
|
41
|
-
let __wrappedFunction = bridge.wrap_Func_void_std__string(self.__onError)
|
|
42
|
-
return { (__errorMessage: String) -> Void in
|
|
43
|
-
__wrappedFunction.call(std.string(__errorMessage))
|
|
44
|
-
}
|
|
45
|
-
}()
|
|
46
|
-
}
|
|
47
|
-
@inline(__always)
|
|
48
|
-
set {
|
|
49
|
-
self.__onError = { () -> bridge.Func_void_std__string in
|
|
50
|
-
let __closureWrapper = Func_void_std__string(newValue)
|
|
51
|
-
return bridge.create_Func_void_std__string(__closureWrapper.toUnsafe())
|
|
52
|
-
}()
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
var onStateChange: (_ toState: WorkoutSessionState, _ fromState: WorkoutSessionState, _ date: Date) -> Void {
|
|
57
|
-
@inline(__always)
|
|
58
|
-
get {
|
|
59
|
-
return { () -> (WorkoutSessionState, WorkoutSessionState, Date) -> Void in
|
|
60
|
-
let __wrappedFunction = bridge.wrap_Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point(self.__onStateChange)
|
|
61
|
-
return { (__toState: WorkoutSessionState, __fromState: WorkoutSessionState, __date: Date) -> Void in
|
|
62
|
-
__wrappedFunction.call(__toState.rawValue, __fromState.rawValue, __date.toCpp())
|
|
63
|
-
}
|
|
64
|
-
}()
|
|
65
|
-
}
|
|
66
|
-
@inline(__always)
|
|
67
|
-
set {
|
|
68
|
-
self.__onStateChange = { () -> bridge.Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point in
|
|
69
|
-
let __closureWrapper = Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point(newValue)
|
|
70
|
-
return bridge.create_Func_void_WorkoutSessionState_WorkoutSessionState_std__chrono__system_clock__time_point(__closureWrapper.toUnsafe())
|
|
71
|
-
}()
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
var onDataReceived: (_ data: [RemoteSessionSharableData]) -> Void {
|
|
76
|
-
@inline(__always)
|
|
77
|
-
get {
|
|
78
|
-
return { () -> ([RemoteSessionSharableData]) -> Void in
|
|
79
|
-
let __wrappedFunction = bridge.wrap_Func_void_std__vector_RemoteSessionSharableData_(self.__onDataReceived)
|
|
80
|
-
return { (__data: [RemoteSessionSharableData]) -> Void in
|
|
81
|
-
__wrappedFunction.call({ () -> bridge.std__vector_RemoteSessionSharableData_ in
|
|
82
|
-
var __vector = bridge.create_std__vector_RemoteSessionSharableData_(__data.count)
|
|
83
|
-
for __item in __data {
|
|
84
|
-
__vector.push_back(__item)
|
|
85
|
-
}
|
|
86
|
-
return __vector
|
|
87
|
-
}())
|
|
88
|
-
}
|
|
89
|
-
}()
|
|
90
|
-
}
|
|
91
|
-
@inline(__always)
|
|
92
|
-
set {
|
|
93
|
-
self.__onDataReceived = { () -> bridge.Func_void_std__vector_RemoteSessionSharableData_ in
|
|
94
|
-
let __closureWrapper = Func_void_std__vector_RemoteSessionSharableData_(newValue)
|
|
95
|
-
return bridge.create_Func_void_std__vector_RemoteSessionSharableData_(__closureWrapper.toUnsafe())
|
|
96
|
-
}()
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
var onEventReceived: (_ type: WorkoutEventType) -> Void {
|
|
101
|
-
@inline(__always)
|
|
102
|
-
get {
|
|
103
|
-
return { () -> (WorkoutEventType) -> Void in
|
|
104
|
-
let __wrappedFunction = bridge.wrap_Func_void_WorkoutEventType(self.__onEventReceived)
|
|
105
|
-
return { (__type: WorkoutEventType) -> Void in
|
|
106
|
-
__wrappedFunction.call(__type.rawValue)
|
|
107
|
-
}
|
|
108
|
-
}()
|
|
109
|
-
}
|
|
110
|
-
@inline(__always)
|
|
111
|
-
set {
|
|
112
|
-
self.__onEventReceived = { () -> bridge.Func_void_WorkoutEventType in
|
|
113
|
-
let __closureWrapper = Func_void_WorkoutEventType(newValue)
|
|
114
|
-
return bridge.create_Func_void_WorkoutEventType(__closureWrapper.toUnsafe())
|
|
115
|
-
}()
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// WorkoutSessionState.swift
|
|
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
|
-
/**
|
|
9
|
-
* Represents the JS enum `WorkoutSessionState`, backed by a C++ enum.
|
|
10
|
-
*/
|
|
11
|
-
public typealias WorkoutSessionState = margelo.nitro.healthkit.WorkoutSessionState
|
|
12
|
-
|
|
13
|
-
public extension WorkoutSessionState {
|
|
14
|
-
/**
|
|
15
|
-
* Get a WorkoutSessionState for the given String value, or
|
|
16
|
-
* return `nil` if the given value was invalid/unknown.
|
|
17
|
-
*/
|
|
18
|
-
init?(fromString string: String) {
|
|
19
|
-
switch string {
|
|
20
|
-
case "NotStarted":
|
|
21
|
-
self = .notstarted
|
|
22
|
-
case "Running":
|
|
23
|
-
self = .running
|
|
24
|
-
case "Ended":
|
|
25
|
-
self = .ended
|
|
26
|
-
case "Paused":
|
|
27
|
-
self = .paused
|
|
28
|
-
case "Prepared":
|
|
29
|
-
self = .prepared
|
|
30
|
-
case "Stopped":
|
|
31
|
-
self = .stopped
|
|
32
|
-
default:
|
|
33
|
-
return nil
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Get the String value this WorkoutSessionState represents.
|
|
39
|
-
*/
|
|
40
|
-
var stringValue: String {
|
|
41
|
-
switch self {
|
|
42
|
-
case .notstarted:
|
|
43
|
-
return "NotStarted"
|
|
44
|
-
case .running:
|
|
45
|
-
return "Running"
|
|
46
|
-
case .ended:
|
|
47
|
-
return "Ended"
|
|
48
|
-
case .paused:
|
|
49
|
-
return "Paused"
|
|
50
|
-
case .prepared:
|
|
51
|
-
return "Prepared"
|
|
52
|
-
case .stopped:
|
|
53
|
-
return "Stopped"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
///
|
|
2
|
-
/// HybridWorkoutSessionModuleSpec.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 "HybridWorkoutSessionModuleSpec.hpp"
|
|
9
|
-
|
|
10
|
-
namespace margelo::nitro::healthkit {
|
|
11
|
-
|
|
12
|
-
void HybridWorkoutSessionModuleSpec::loadHybridMethods() {
|
|
13
|
-
// load base methods/properties
|
|
14
|
-
HybridObject::loadHybridMethods();
|
|
15
|
-
// load custom methods/properties
|
|
16
|
-
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
-
prototype.registerHybridMethod("startWatchAppWithWorkoutConfiguration", &HybridWorkoutSessionModuleSpec::startWatchAppWithWorkoutConfiguration);
|
|
18
|
-
prototype.registerHybridMethod("workoutSessionMirroringStartHandler", &HybridWorkoutSessionModuleSpec::workoutSessionMirroringStartHandler);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
} // namespace margelo::nitro::healthkit
|