react-nitro-navigation 0.0.0-stage → 0.0.1-alpha.7
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/Package.swift +104 -0
- package/README.md +20 -2
- package/Sources/ReactNitroNavigation/HybridNavigationScreen.swift +27 -0
- package/Sources/ReactNitroNavigation/HybridNavigationStack.swift +103 -0
- package/Sources/ReactNitroNavigation/NavigationControllerDelegate.swift +11 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/apple/ReactNitroNavigation-Swift-Cxx-Bridge.cpp +109 -0
- package/nitrogen/generated/apple/ReactNitroNavigationAppleCxx/ReactNitroNavigationAppleCxx.cpp +9 -0
- package/nitrogen/generated/apple/ReactNitroNavigationAppleCxx/include/ReactNitroNavigationAppleCxx/ReactNitroNavigationAppleCxx.h +120 -0
- package/nitrogen/generated/apple/ReactNitroNavigationAutolinking.cpp +22 -0
- package/nitrogen/generated/apple/ReactNitroNavigationAutolinking.mm +24 -0
- package/nitrogen/generated/apple/c++/HybridNavigationScreenSpecSwift.cpp +54 -0
- package/nitrogen/generated/apple/c++/HybridNavigationScreenSpec_cxx-Swift.cpp +28 -0
- package/nitrogen/generated/apple/c++/HybridNavigationStackSpecSwift.cpp +69 -0
- package/nitrogen/generated/apple/c++/HybridNavigationStackSpec_cxx-Swift.cpp +28 -0
- package/nitrogen/generated/apple/c++/ListenerSubscription-Swift.cpp +37 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/ReactNitroNavigationAutolinking.hpp +13 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/private/HybridNavigationScreenSpecSwift.hpp +75 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/private/HybridNavigationScreenSpec_cxx-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/private/HybridNavigationStackSpecSwift.hpp +75 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/private/HybridNavigationStackSpec_cxx-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/private/ListenerSubscription-Swift.hpp +23 -0
- package/nitrogen/generated/apple/c++/include/ReactNitroNavigation/private/ReactNitroNavigation-Swift-Cxx-Umbrella.hpp +48 -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_double.swift +60 -0
- package/nitrogen/generated/apple/swift/HybridNavigationScreenSpec.swift +68 -0
- package/nitrogen/generated/apple/swift/HybridNavigationScreenSpec_cxx.swift +163 -0
- package/nitrogen/generated/apple/swift/HybridNavigationStackSpec.swift +69 -0
- package/nitrogen/generated/apple/swift/HybridNavigationStackSpec_cxx.swift +177 -0
- package/nitrogen/generated/apple/swift/ListenerSubscription.swift +29 -0
- package/nitrogen/generated/apple/swift/Promise_void.swift +100 -0
- package/nitrogen/generated/hybrid-classes.json +21 -0
- package/nitrogen/generated/shared/c++/ReactNitroNavigationCxxModule.cpp +2 -0
- package/nitrogen/generated/shared/c++/include/ReactNitroNavigation/ReactNitroNavigationCxxModule.hpp +2 -0
- package/nitrogen/generated/shared/javascript/NavigationScreen.cjs +19 -0
- package/nitrogen/generated/shared/javascript/NavigationScreen.d.cts +9 -0
- package/nitrogen/generated/shared/javascript/NavigationStack.cjs +19 -0
- package/nitrogen/generated/shared/javascript/NavigationStack.d.cts +9 -0
- package/package.json +33 -4
- package/src/NativeScreenHost.ts +18 -0
- package/src/NativeStackHost.ts +14 -0
- package/src/StackNavigationOptions.ts +7 -0
- package/src/StackNavigationProp.ts +8 -0
- package/src/StackScreen.tsx +19 -0
- package/src/createStackNavigator.tsx +67 -0
- package/src/index.ts +4 -0
- package/src/specs/NavigationScreen.nitro.ts +17 -0
- package/src/specs/NavigationStack.nitro.ts +20 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Margelo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
10
|
+
so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/Package.swift
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// swift-tools-version: 6.4
|
|
2
|
+
|
|
3
|
+
import Foundation
|
|
4
|
+
import PackageDescription
|
|
5
|
+
|
|
6
|
+
let name = "ReactNitroNavigation"
|
|
7
|
+
let generated = "nitrogen/generated"
|
|
8
|
+
let nitroDependencies: [Target.Dependency] = [
|
|
9
|
+
.product(name: "NitroModules", package: "nitro-core"),
|
|
10
|
+
.product(name: "ReactNitroRenderer", package: "react-nitro-renderer"),
|
|
11
|
+
]
|
|
12
|
+
let cxxSettings: [CXXSetting] = [
|
|
13
|
+
.define("DEBUG", .when(configuration: .debug)),
|
|
14
|
+
.define("NDEBUG", .when(configuration: .release)),
|
|
15
|
+
.disableWarning("nullability-extension"),
|
|
16
|
+
]
|
|
17
|
+
let swiftSources = ["Sources/ReactNitroNavigation", "\(generated)/apple/swift"]
|
|
18
|
+
let bridgeSources = [
|
|
19
|
+
"c++", "ReactNitroNavigation-Swift-Cxx-Bridge.cpp", "ReactNitroNavigationAutolinking.cpp",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
// Bare-host integration. Nitrogen generates the bindings; this manifest owns the targets.
|
|
23
|
+
let package = Package(
|
|
24
|
+
name: name,
|
|
25
|
+
platforms: [.iOS(.v16), .macOS(.v13)],
|
|
26
|
+
products: [
|
|
27
|
+
.library(name: name, targets: ["\(name)Cxx", name, "\(name)SwiftBridge"])
|
|
28
|
+
],
|
|
29
|
+
dependencies: [
|
|
30
|
+
.package(path: "../nitro-core"),
|
|
31
|
+
.package(path: "../react-nitro-renderer"),
|
|
32
|
+
],
|
|
33
|
+
targets: [
|
|
34
|
+
.target(
|
|
35
|
+
name: "\(name)Cxx",
|
|
36
|
+
dependencies: nitroDependencies,
|
|
37
|
+
path: "\(generated)/shared/c++",
|
|
38
|
+
exclude: ["include"],
|
|
39
|
+
publicHeadersPath: "include",
|
|
40
|
+
cxxSettings: cxxSettings
|
|
41
|
+
),
|
|
42
|
+
.target(
|
|
43
|
+
name: "\(name)AppleCxx",
|
|
44
|
+
dependencies: [.target(name: "\(name)Cxx")] + nitroDependencies,
|
|
45
|
+
path: "\(generated)/apple/\(name)AppleCxx",
|
|
46
|
+
cxxSettings: cxxSettings
|
|
47
|
+
),
|
|
48
|
+
.target(
|
|
49
|
+
name: name,
|
|
50
|
+
dependencies: [.target(name: "\(name)AppleCxx")] + nitroDependencies,
|
|
51
|
+
path: ".",
|
|
52
|
+
exclude: excludes(in: ".", keeping: swiftSources),
|
|
53
|
+
sources: swiftSources,
|
|
54
|
+
cxxSettings: cxxSettings,
|
|
55
|
+
swiftSettings: [
|
|
56
|
+
// UIKit implementations run synchronously on the host's main thread.
|
|
57
|
+
.swiftLanguageMode(.v5),
|
|
58
|
+
.unsafeFlags(["-strict-concurrency=minimal"]),
|
|
59
|
+
.enableUpcomingFeature("InternalImportsByDefault"),
|
|
60
|
+
.enableUpcomingFeature("MemberImportVisibility"),
|
|
61
|
+
.interoperabilityMode(.Cxx),
|
|
62
|
+
.unsafeFlags(["-Xfrontend", "-clang-header-expose-decls=has-expose-attr-or-stdlib"]),
|
|
63
|
+
.unsafeFlags([
|
|
64
|
+
"-Xfrontend", "-clang-header-expose-module",
|
|
65
|
+
"-Xfrontend", "NitroModules=NitroModules-Swift.h",
|
|
66
|
+
]),
|
|
67
|
+
]
|
|
68
|
+
),
|
|
69
|
+
.target(
|
|
70
|
+
name: "\(name)SwiftBridge",
|
|
71
|
+
dependencies: [.target(name: name), .target(name: "\(name)AppleCxx")] + nitroDependencies,
|
|
72
|
+
path: "\(generated)/apple",
|
|
73
|
+
exclude: excludes(in: "\(generated)/apple", keeping: bridgeSources) + ["c++/include"],
|
|
74
|
+
sources: bridgeSources,
|
|
75
|
+
publicHeadersPath: "c++/include",
|
|
76
|
+
cxxSettings: cxxSettings + [
|
|
77
|
+
.unsafeFlags(["-I${GENERATED_MODULEMAP_DIR}", "-fno-modules"])
|
|
78
|
+
]
|
|
79
|
+
),
|
|
80
|
+
],
|
|
81
|
+
cxxLanguageStandard: .cxx20
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
func excludes(in path: String, keeping sources: [String]) -> [String] {
|
|
85
|
+
var parents: Set<String> = [""]
|
|
86
|
+
for source in sources {
|
|
87
|
+
var components = source.split(separator: "/").dropLast()
|
|
88
|
+
while !components.isEmpty {
|
|
89
|
+
parents.insert(components.joined(separator: "/"))
|
|
90
|
+
components = components.dropLast()
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
let root = URL(fileURLWithPath: Context.packageDirectory).appendingPathComponent(path)
|
|
94
|
+
return parents.sorted().flatMap { parent in
|
|
95
|
+
let entries =
|
|
96
|
+
(try? FileManager.default.contentsOfDirectory(
|
|
97
|
+
atPath: root.appendingPathComponent(parent).path)) ?? []
|
|
98
|
+
return entries.sorted().compactMap { entry in
|
|
99
|
+
let entryPath = parent.isEmpty ? entry : "\(parent)/\(entry)"
|
|
100
|
+
return entry.hasPrefix(".") || sources.contains(entryPath) || parents.contains(entryPath)
|
|
101
|
+
? nil : entryPath
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# React Nitro Navigation spike
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Uses React Navigation Core and Routers with a Nitro bridge to UIKit's
|
|
4
|
+
`UINavigationController`. The example app demonstrates Home → Animations → Spring.
|
|
5
|
+
|
|
6
|
+
- `NavigationContainer` is the core's `BaseNavigationContainer`.
|
|
7
|
+
- `createStackNavigator` supports the dynamic `Navigator` / `Screen` API and titles.
|
|
8
|
+
- JS push/back actions update the native stack. Completed native back actions pop
|
|
9
|
+
the router; cancelled gestures leave its state unchanged.
|
|
10
|
+
- Stack and screen host components stay in the normal React tree. The native stack
|
|
11
|
+
keeps its ordered screen children and gives their views to `UINavigationController`.
|
|
12
|
+
- UIKit positions screen roots during transitions. Their Yoga nodes fill the stack
|
|
13
|
+
and lay out the screen contents. Each screen provides its controller's safe area.
|
|
14
|
+
|
|
15
|
+
The native implementations, Nitro specs, generated bindings, and Swift package
|
|
16
|
+
belong to this package. The renderer exposes generic host registration and
|
|
17
|
+
controller construction; it has no navigation dependency.
|
|
18
|
+
|
|
19
|
+
This is an iOS spike. Deep links, tabs, modals, removal prevention, transition
|
|
20
|
+
events, and retaining removed screens during JS-driven pop animations are outside
|
|
21
|
+
its scope.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
internal import NitroModules
|
|
2
|
+
internal import ReactNitroRenderer
|
|
3
|
+
internal import UIKit
|
|
4
|
+
|
|
5
|
+
final class HybridNavigationScreen: HybridNavigationScreenSpec {
|
|
6
|
+
typealias AllowedChildrenType = any View
|
|
7
|
+
|
|
8
|
+
let yogaNode = YGNode()
|
|
9
|
+
var parentReference: (any HybridViewSpec)?
|
|
10
|
+
let viewController: any HybridViewControllerSpec
|
|
11
|
+
var view: UIView { return viewController.viewController.view }
|
|
12
|
+
|
|
13
|
+
override init() throws {
|
|
14
|
+
viewController = try HybridViewController()
|
|
15
|
+
try super.init()
|
|
16
|
+
view.backgroundColor = .systemBackground
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var title: String? {
|
|
20
|
+
get { return viewController.viewController.title }
|
|
21
|
+
set { viewController.viewController.title = newValue }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
func setFrame(frame: Frame) throws {
|
|
25
|
+
// UIKit positions the screen root during transitions; Yoga only positions its children.
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
internal import Foundation
|
|
2
|
+
internal import NitroModules
|
|
3
|
+
internal import NitroModulesCxx
|
|
4
|
+
internal import ReactNitroRenderer
|
|
5
|
+
internal import UIKit
|
|
6
|
+
|
|
7
|
+
final class HybridNavigationStack: HybridNavigationStackSpec {
|
|
8
|
+
typealias AllowedChildrenType = HybridNavigationScreen
|
|
9
|
+
|
|
10
|
+
let view = UIView()
|
|
11
|
+
let yogaNode = YGNode()
|
|
12
|
+
var parentReference: (any HybridViewSpec)?
|
|
13
|
+
|
|
14
|
+
private let navigationController = UINavigationController()
|
|
15
|
+
private let delegate = NavigationControllerDelegate()
|
|
16
|
+
private var screens: [HybridNavigationScreen] = []
|
|
17
|
+
private var expectedCount = 0
|
|
18
|
+
private var listeners: [UUID: any Callback<Double, Void>] = [:]
|
|
19
|
+
|
|
20
|
+
override init() throws {
|
|
21
|
+
try super.init()
|
|
22
|
+
navigationController.delegate = delegate
|
|
23
|
+
delegate.onDidShow = { [weak self] in self?.didShow() }
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
func attachTo(parent: any HybridViewControllerSpec) throws {
|
|
27
|
+
let parentController = parent.viewController
|
|
28
|
+
parentController.addChild(navigationController)
|
|
29
|
+
navigationController.view.frame = view.bounds
|
|
30
|
+
navigationController.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
31
|
+
view.addSubview(navigationController.view)
|
|
32
|
+
navigationController.didMove(toParent: parentController)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
func removeFromParent() throws {
|
|
36
|
+
navigationController.willMove(toParent: nil)
|
|
37
|
+
navigationController.view.removeFromSuperview()
|
|
38
|
+
navigationController.removeFromParent()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
func appendChild(child: any HybridViewSpec) throws {
|
|
42
|
+
guard let screen = child as? HybridNavigationScreen else {
|
|
43
|
+
throw RuntimeError("A navigation stack only accepts navigation screens.")
|
|
44
|
+
}
|
|
45
|
+
screens.removeAll { $0 === screen }
|
|
46
|
+
screens.append(screen)
|
|
47
|
+
screen.parentReference = self
|
|
48
|
+
updateControllers()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
func insertBefore(child: any HybridViewSpec, beforeChild: any HybridViewSpec) throws {
|
|
52
|
+
if child === beforeChild { return }
|
|
53
|
+
guard let screen = child as? HybridNavigationScreen else {
|
|
54
|
+
throw RuntimeError("A navigation stack only accepts navigation screens.")
|
|
55
|
+
}
|
|
56
|
+
screens.removeAll { $0 === screen }
|
|
57
|
+
guard let index = screens.firstIndex(where: { $0 === beforeChild }) else {
|
|
58
|
+
throw RuntimeError("The screen to insert before is not in this stack.")
|
|
59
|
+
}
|
|
60
|
+
screens.insert(screen, at: index)
|
|
61
|
+
screen.parentReference = self
|
|
62
|
+
updateControllers()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
func removeChild(child: any HybridViewSpec) throws {
|
|
66
|
+
screens.removeAll { $0 === child }
|
|
67
|
+
child.parentReference = nil
|
|
68
|
+
updateControllers()
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
func addOnPopListener(listener: any Callback<Double, Void>) throws -> ListenerSubscription {
|
|
72
|
+
let id = UUID()
|
|
73
|
+
listeners[id] = listener
|
|
74
|
+
let remove: any Callback<(), Void> = .native { [weak self] in
|
|
75
|
+
self?.listeners.removeValue(forKey: id)
|
|
76
|
+
}
|
|
77
|
+
return ListenerSubscription(remove: remove)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private func updateControllers() {
|
|
81
|
+
let controllers = screens.map { $0.viewController.viewController }
|
|
82
|
+
expectedCount = controllers.count
|
|
83
|
+
let animated = navigationController.view.window != nil
|
|
84
|
+
navigationController.setViewControllers(controllers, animated: animated)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private func didShow() {
|
|
88
|
+
let count = navigationController.viewControllers.count
|
|
89
|
+
let removedCount = expectedCount - count
|
|
90
|
+
expectedCount = count
|
|
91
|
+
guard removedCount > 0 else { return }
|
|
92
|
+
let currentListeners = Array(listeners.values)
|
|
93
|
+
let removedCountValue = Double(removedCount)
|
|
94
|
+
for listener in currentListeners {
|
|
95
|
+
do {
|
|
96
|
+
try listener.callSync(removedCountValue)
|
|
97
|
+
} catch {
|
|
98
|
+
let nativeError = error.toCpp()
|
|
99
|
+
margelo.nitro.GlobalErrorHandler.reportError(.UICallback, nativeError)
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
internal import UIKit
|
|
2
|
+
|
|
3
|
+
final class NavigationControllerDelegate: NSObject, UINavigationControllerDelegate {
|
|
4
|
+
var onDidShow: (() -> Void)?
|
|
5
|
+
|
|
6
|
+
func navigationController(_ navigationController: UINavigationController,
|
|
7
|
+
didShow viewController: UIViewController,
|
|
8
|
+
animated: Bool) {
|
|
9
|
+
onDidShow?()
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
** linguist-generated=true
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNitroNavigation-Swift-Cxx-Bridge.cpp
|
|
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
|
+
#include <ReactNitroNavigation/private/ReactNitroNavigation-Swift-Cxx-Umbrella.hpp>
|
|
8
|
+
#include <ReactNitroRendererAppleCxx/ReactNitroRendererAppleCxx.h>
|
|
9
|
+
#include <ReactNitroNavigation/private/HybridNavigationScreenSpecSwift.hpp>
|
|
10
|
+
#include <ReactNitroNavigation/private/HybridNavigationStackSpecSwift.hpp>
|
|
11
|
+
#include <NitroModules/Callback.hpp>
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::navigation::swift_bridge {
|
|
14
|
+
std__shared_ptr_margelo__nitro__renderer__HybridViewSpec_ create_std__shared_ptr_margelo__nitro__renderer__HybridViewSpec_(void* NON_NULL pointer) {
|
|
15
|
+
return margelo::nitro::renderer::swift_bridge::create_std__shared_ptr_margelo__nitro__renderer__HybridViewSpec_(pointer);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__renderer__HybridViewSpec_(const std::shared_ptr<HybridObject>& value) {
|
|
19
|
+
return margelo::nitro::renderer::swift_bridge::get_std__shared_ptr_margelo__nitro__renderer__HybridViewSpec_(value);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
std__shared_ptr_margelo__nitro__renderer__HybridAnimatorSpec_ create_std__shared_ptr_margelo__nitro__renderer__HybridAnimatorSpec_(void* NON_NULL pointer) {
|
|
23
|
+
return margelo::nitro::renderer::swift_bridge::create_std__shared_ptr_margelo__nitro__renderer__HybridAnimatorSpec_(pointer);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__renderer__HybridAnimatorSpec_(const std::shared_ptr<HybridObject>& value) {
|
|
27
|
+
return margelo::nitro::renderer::swift_bridge::get_std__shared_ptr_margelo__nitro__renderer__HybridAnimatorSpec_(value);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
std__shared_ptr_margelo__nitro__renderer__HybridGestureRecognizerSpec_ create_std__shared_ptr_margelo__nitro__renderer__HybridGestureRecognizerSpec_(void* NON_NULL pointer) {
|
|
31
|
+
return margelo::nitro::renderer::swift_bridge::create_std__shared_ptr_margelo__nitro__renderer__HybridGestureRecognizerSpec_(pointer);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__renderer__HybridGestureRecognizerSpec_(const std::shared_ptr<HybridObject>& value) {
|
|
35
|
+
return margelo::nitro::renderer::swift_bridge::get_std__shared_ptr_margelo__nitro__renderer__HybridGestureRecognizerSpec_(value);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
std__shared_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_ create_std__shared_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_(void* NON_NULL pointer) {
|
|
39
|
+
return std::make_shared<margelo::nitro::navigation::HybridNavigationScreenSpecSwift>(::ReactNitroNavigation::HybridNavigationScreenSpec_cxx::fromUnsafe(pointer));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_(const std::shared_ptr<HybridObject>& value) {
|
|
43
|
+
auto wrapper = std::dynamic_pointer_cast<margelo::nitro::navigation::HybridNavigationScreenSpecSwift>(value);
|
|
44
|
+
if (!wrapper) throw std::runtime_error("HybridNavigationScreenSpec is not implemented in Swift");
|
|
45
|
+
return wrapper->getSwiftPart().toUnsafe();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
std::shared_ptr<margelo::nitro::renderer::HybridViewSpecSwift> upcast_NavigationScreen_to_View(const std__shared_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_& value) {
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
std__shared_ptr_margelo__nitro__renderer__HybridViewControllerSpec_ create_std__shared_ptr_margelo__nitro__renderer__HybridViewControllerSpec_(void* NON_NULL pointer) {
|
|
53
|
+
return margelo::nitro::renderer::swift_bridge::create_std__shared_ptr_margelo__nitro__renderer__HybridViewControllerSpec_(pointer);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__renderer__HybridViewControllerSpec_(const std::shared_ptr<HybridObject>& value) {
|
|
57
|
+
return margelo::nitro::renderer::swift_bridge::get_std__shared_ptr_margelo__nitro__renderer__HybridViewControllerSpec_(value);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
std__shared_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_ create_std__shared_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_(void* NON_NULL pointer) {
|
|
61
|
+
return std::make_shared<margelo::nitro::navigation::HybridNavigationStackSpecSwift>(::ReactNitroNavigation::HybridNavigationStackSpec_cxx::fromUnsafe(pointer));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_(const std::shared_ptr<HybridObject>& value) {
|
|
65
|
+
auto wrapper = std::dynamic_pointer_cast<margelo::nitro::navigation::HybridNavigationStackSpecSwift>(value);
|
|
66
|
+
if (!wrapper) throw std::runtime_error("HybridNavigationStackSpec is not implemented in Swift");
|
|
67
|
+
return wrapper->getSwiftPart().toUnsafe();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
std::shared_ptr<margelo::nitro::renderer::HybridViewSpecSwift> upcast_NavigationStack_to_View(const std__shared_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_& value) {
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
Result<void, margelo::nitro::navigation::swift_bridge::ResultTag> callSync_Callback_void(const Callback_void& callback) noexcept {
|
|
75
|
+
try {
|
|
76
|
+
callback.callSync();
|
|
77
|
+
return Result<void, margelo::nitro::navigation::swift_bridge::ResultTag>::withValue();
|
|
78
|
+
} catch (...) {
|
|
79
|
+
return Result<void, margelo::nitro::navigation::swift_bridge::ResultTag>::withError(std::current_exception());
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
Callback_void create_Callback_void(std::function<Result<void, margelo::nitro::navigation::swift_bridge::ResultTag>()> closure) {
|
|
84
|
+
return Callback_void::make([closure = std::move(closure)]() -> void {
|
|
85
|
+
auto __result = closure();
|
|
86
|
+
if (__result.hasError()) [[unlikely]] {
|
|
87
|
+
std::rethrow_exception(__result.error());
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
Result<void, margelo::nitro::navigation::swift_bridge::ResultTag> callSync_Callback_void_double(const Callback_void_double& callback, double param0) noexcept {
|
|
93
|
+
try {
|
|
94
|
+
callback.callSync(param0);
|
|
95
|
+
return Result<void, margelo::nitro::navigation::swift_bridge::ResultTag>::withValue();
|
|
96
|
+
} catch (...) {
|
|
97
|
+
return Result<void, margelo::nitro::navigation::swift_bridge::ResultTag>::withError(std::current_exception());
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
Callback_void_double create_Callback_void_double(std::function<Result<void, margelo::nitro::navigation::swift_bridge::ResultTag>(double param0)> closure) {
|
|
102
|
+
return Callback_void_double::make([closure = std::move(closure)](double param0) -> void {
|
|
103
|
+
auto __result = closure(param0);
|
|
104
|
+
if (__result.hasError()) [[unlikely]] {
|
|
105
|
+
std::rethrow_exception(__result.error());
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
} // namespace margelo::nitro::navigation::swift_bridge
|
package/nitrogen/generated/apple/ReactNitroNavigationAppleCxx/ReactNitroNavigationAppleCxx.cpp
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNitroNavigationAppleCxx.cpp
|
|
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
|
+
// Swift packages require at least one source file per C++ target.
|
|
9
|
+
#include <ReactNitroNavigationAppleCxx/ReactNitroNavigationAppleCxx.h>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNitroNavigationAppleCxx.h
|
|
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
|
+
#pragma once
|
|
9
|
+
// Each Nitro module declares parts of the margelo::nitro namespace, and Swift
|
|
10
|
+
// treats the namespace as owned by one of them. Re-export the modules this one
|
|
11
|
+
// uses, so Swift files that import this module can name the namespace.
|
|
12
|
+
#include <ReactNitroRendererAppleCxx/ReactNitroRendererAppleCxx.h>
|
|
13
|
+
// Forward declaration of `HybridViewSpec_cxx` to properly resolve imports.
|
|
14
|
+
namespace ReactNitroRenderer { class HybridViewSpec_cxx; }
|
|
15
|
+
#ifndef SWIFT_SWIFT_H
|
|
16
|
+
namespace swift { template <class T> class Optional; }
|
|
17
|
+
#endif
|
|
18
|
+
// Forward declaration of `EdgeInsets` to properly resolve imports.
|
|
19
|
+
namespace ReactNitroRenderer { class EdgeInsets; }
|
|
20
|
+
// Forward declaration of `Corner` to properly resolve imports.
|
|
21
|
+
namespace ReactNitroRenderer { class Corner; }
|
|
22
|
+
#ifndef SWIFT_SWIFT_H
|
|
23
|
+
namespace swift { template <class T> class Array; }
|
|
24
|
+
#endif
|
|
25
|
+
// Forward declaration of `CornerCurve` to properly resolve imports.
|
|
26
|
+
namespace ReactNitroRenderer { class CornerCurve; }
|
|
27
|
+
// Forward declaration of `Point3D` to properly resolve imports.
|
|
28
|
+
namespace ReactNitroRenderer { class Point3D; }
|
|
29
|
+
// Forward declaration of `Frame` to properly resolve imports.
|
|
30
|
+
namespace ReactNitroRenderer { class Frame; }
|
|
31
|
+
// Forward declaration of `HybridAnimatorSpec_cxx` to properly resolve imports.
|
|
32
|
+
namespace ReactNitroRenderer { class HybridAnimatorSpec_cxx; }
|
|
33
|
+
// Forward declaration of `HybridGestureRecognizerSpec_cxx` to properly resolve imports.
|
|
34
|
+
namespace ReactNitroRenderer { class HybridGestureRecognizerSpec_cxx; }
|
|
35
|
+
// Forward declaration of `AnimationCurve` to properly resolve imports.
|
|
36
|
+
namespace ReactNitroRenderer { class AnimationCurve; }
|
|
37
|
+
#include <NitroModules/Callback.hpp>
|
|
38
|
+
#include <NitroModules/Result.hpp>
|
|
39
|
+
// Forward declaration of `HybridNavigationScreenSpec_cxx` to properly resolve imports.
|
|
40
|
+
namespace ReactNitroNavigation { class HybridNavigationScreenSpec_cxx; }
|
|
41
|
+
// Forward declaration of `HybridViewControllerSpec_cxx` to properly resolve imports.
|
|
42
|
+
namespace ReactNitroRenderer { class HybridViewControllerSpec_cxx; }
|
|
43
|
+
namespace swift { class String; }
|
|
44
|
+
// Forward declaration of `HybridNavigationStackSpec_cxx` to properly resolve imports.
|
|
45
|
+
namespace ReactNitroNavigation { class HybridNavigationStackSpec_cxx; }
|
|
46
|
+
// Forward declaration of `ListenerSubscription` to properly resolve imports.
|
|
47
|
+
namespace ReactNitroNavigation { class ListenerSubscription; }
|
|
48
|
+
#include <NitroModules/HybridObject.hpp>
|
|
49
|
+
// Forward declaration of `HybridViewSpecSwift` to properly resolve imports.
|
|
50
|
+
namespace margelo::nitro::renderer { class HybridViewSpecSwift; }
|
|
51
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
52
|
+
// Forward declaration of `HybridAnimatorSpecSwift` to properly resolve imports.
|
|
53
|
+
namespace margelo::nitro::renderer { class HybridAnimatorSpecSwift; }
|
|
54
|
+
// Forward declaration of `HybridGestureRecognizerSpecSwift` to properly resolve imports.
|
|
55
|
+
namespace margelo::nitro::renderer { class HybridGestureRecognizerSpecSwift; }
|
|
56
|
+
// Forward declaration of `HybridNavigationScreenSpecSwift` to properly resolve imports.
|
|
57
|
+
namespace margelo::nitro::navigation { class HybridNavigationScreenSpecSwift; }
|
|
58
|
+
// Forward declaration of `HybridViewControllerSpecSwift` to properly resolve imports.
|
|
59
|
+
namespace margelo::nitro::renderer { class HybridViewControllerSpecSwift; }
|
|
60
|
+
// Forward declaration of `HybridNavigationStackSpecSwift` to properly resolve imports.
|
|
61
|
+
namespace margelo::nitro::navigation { class HybridNavigationStackSpecSwift; }
|
|
62
|
+
#include <NitroModules/Promise.hpp>
|
|
63
|
+
|
|
64
|
+
namespace margelo::nitro::navigation::swift_bridge {
|
|
65
|
+
using std__shared_ptr_margelo__nitro__renderer__HybridViewSpec_ = std::shared_ptr<margelo::nitro::renderer::HybridViewSpecSwift>;
|
|
66
|
+
using std__weak_ptr_margelo__nitro__renderer__HybridViewSpec_ = std::weak_ptr<margelo::nitro::renderer::HybridViewSpecSwift>;
|
|
67
|
+
inline std__weak_ptr_margelo__nitro__renderer__HybridViewSpec_ weakify_std__shared_ptr_margelo__nitro__renderer__HybridViewSpec_(const std__shared_ptr_margelo__nitro__renderer__HybridViewSpec_& value) {
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
std__shared_ptr_margelo__nitro__renderer__HybridViewSpec_ create_std__shared_ptr_margelo__nitro__renderer__HybridViewSpec_(void* NON_NULL pointer);
|
|
71
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__renderer__HybridViewSpec_(const std::shared_ptr<HybridObject>& value);
|
|
72
|
+
using std__shared_ptr_margelo__nitro__renderer__HybridAnimatorSpec_ = std::shared_ptr<margelo::nitro::renderer::HybridAnimatorSpecSwift>;
|
|
73
|
+
using std__weak_ptr_margelo__nitro__renderer__HybridAnimatorSpec_ = std::weak_ptr<margelo::nitro::renderer::HybridAnimatorSpecSwift>;
|
|
74
|
+
inline std__weak_ptr_margelo__nitro__renderer__HybridAnimatorSpec_ weakify_std__shared_ptr_margelo__nitro__renderer__HybridAnimatorSpec_(const std__shared_ptr_margelo__nitro__renderer__HybridAnimatorSpec_& value) {
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
std__shared_ptr_margelo__nitro__renderer__HybridAnimatorSpec_ create_std__shared_ptr_margelo__nitro__renderer__HybridAnimatorSpec_(void* NON_NULL pointer);
|
|
78
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__renderer__HybridAnimatorSpec_(const std::shared_ptr<HybridObject>& value);
|
|
79
|
+
using std__shared_ptr_margelo__nitro__renderer__HybridGestureRecognizerSpec_ = std::shared_ptr<margelo::nitro::renderer::HybridGestureRecognizerSpecSwift>;
|
|
80
|
+
using std__weak_ptr_margelo__nitro__renderer__HybridGestureRecognizerSpec_ = std::weak_ptr<margelo::nitro::renderer::HybridGestureRecognizerSpecSwift>;
|
|
81
|
+
inline std__weak_ptr_margelo__nitro__renderer__HybridGestureRecognizerSpec_ weakify_std__shared_ptr_margelo__nitro__renderer__HybridGestureRecognizerSpec_(const std__shared_ptr_margelo__nitro__renderer__HybridGestureRecognizerSpec_& value) {
|
|
82
|
+
return value;
|
|
83
|
+
}
|
|
84
|
+
std__shared_ptr_margelo__nitro__renderer__HybridGestureRecognizerSpec_ create_std__shared_ptr_margelo__nitro__renderer__HybridGestureRecognizerSpec_(void* NON_NULL pointer);
|
|
85
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__renderer__HybridGestureRecognizerSpec_(const std::shared_ptr<HybridObject>& value);
|
|
86
|
+
using std__shared_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_ = std::shared_ptr<margelo::nitro::navigation::HybridNavigationScreenSpecSwift>;
|
|
87
|
+
using std__weak_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_ = std::weak_ptr<margelo::nitro::navigation::HybridNavigationScreenSpecSwift>;
|
|
88
|
+
inline std__weak_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_ weakify_std__shared_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_(const std__shared_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_& value) {
|
|
89
|
+
return value;
|
|
90
|
+
}
|
|
91
|
+
std__shared_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_ create_std__shared_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_(void* NON_NULL pointer);
|
|
92
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_(const std::shared_ptr<HybridObject>& value);
|
|
93
|
+
std::shared_ptr<margelo::nitro::renderer::HybridViewSpecSwift> upcast_NavigationScreen_to_View(const std__shared_ptr_margelo__nitro__navigation__HybridNavigationScreenSpec_& value);
|
|
94
|
+
using std__shared_ptr_margelo__nitro__renderer__HybridViewControllerSpec_ = std::shared_ptr<margelo::nitro::renderer::HybridViewControllerSpecSwift>;
|
|
95
|
+
using std__weak_ptr_margelo__nitro__renderer__HybridViewControllerSpec_ = std::weak_ptr<margelo::nitro::renderer::HybridViewControllerSpecSwift>;
|
|
96
|
+
inline std__weak_ptr_margelo__nitro__renderer__HybridViewControllerSpec_ weakify_std__shared_ptr_margelo__nitro__renderer__HybridViewControllerSpec_(const std__shared_ptr_margelo__nitro__renderer__HybridViewControllerSpec_& value) {
|
|
97
|
+
return value;
|
|
98
|
+
}
|
|
99
|
+
std__shared_ptr_margelo__nitro__renderer__HybridViewControllerSpec_ create_std__shared_ptr_margelo__nitro__renderer__HybridViewControllerSpec_(void* NON_NULL pointer);
|
|
100
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__renderer__HybridViewControllerSpec_(const std::shared_ptr<HybridObject>& value);
|
|
101
|
+
// Distinct specializations prevent duplicate Swift metadata across module headers.
|
|
102
|
+
struct ResultTag {};
|
|
103
|
+
using Result_void_ = Result<void*, margelo::nitro::navigation::swift_bridge::ResultTag>;
|
|
104
|
+
using std__shared_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_ = std::shared_ptr<margelo::nitro::navigation::HybridNavigationStackSpecSwift>;
|
|
105
|
+
using std__weak_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_ = std::weak_ptr<margelo::nitro::navigation::HybridNavigationStackSpecSwift>;
|
|
106
|
+
inline std__weak_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_ weakify_std__shared_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_(const std__shared_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_& value) {
|
|
107
|
+
return value;
|
|
108
|
+
}
|
|
109
|
+
std__shared_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_ create_std__shared_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_(void* NON_NULL pointer);
|
|
110
|
+
void* NON_NULL get_std__shared_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_(const std::shared_ptr<HybridObject>& value);
|
|
111
|
+
std::shared_ptr<margelo::nitro::renderer::HybridViewSpecSwift> upcast_NavigationStack_to_View(const std__shared_ptr_margelo__nitro__navigation__HybridNavigationStackSpec_& value);
|
|
112
|
+
using Promise_void = Promise<void>;
|
|
113
|
+
using Result_void = Result<void, margelo::nitro::navigation::swift_bridge::ResultTag>;
|
|
114
|
+
using Callback_void = Callback<void()>;
|
|
115
|
+
Result<void, margelo::nitro::navigation::swift_bridge::ResultTag> callSync_Callback_void(const Callback_void& callback) noexcept;
|
|
116
|
+
Callback_void create_Callback_void(std::function<Result<void, margelo::nitro::navigation::swift_bridge::ResultTag>()> closure);
|
|
117
|
+
using Callback_void_double = Callback<void(double)>;
|
|
118
|
+
Result<void, margelo::nitro::navigation::swift_bridge::ResultTag> callSync_Callback_void_double(const Callback_void_double& callback, double param0) noexcept;
|
|
119
|
+
Callback_void_double create_Callback_void_double(std::function<Result<void, margelo::nitro::navigation::swift_bridge::ResultTag>(double param0)> closure);
|
|
120
|
+
} // namespace margelo::nitro::navigation::swift_bridge
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNitroNavigationAutolinking.cpp
|
|
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
|
+
#include <ReactNitroNavigation/ReactNitroNavigationAutolinking.hpp>
|
|
9
|
+
#include <NitroModules/HybridClassRegistry.hpp>
|
|
10
|
+
|
|
11
|
+
#include <ReactNitroNavigation/private/HybridNavigationScreenSpecSwift.hpp>
|
|
12
|
+
#include <ReactNitroNavigation/private/HybridNavigationStackSpecSwift.hpp>
|
|
13
|
+
|
|
14
|
+
namespace margelo::nitro::navigation {
|
|
15
|
+
void registerHybridClasses() {
|
|
16
|
+
using namespace margelo::nitro;
|
|
17
|
+
using namespace margelo::nitro::navigation;
|
|
18
|
+
|
|
19
|
+
HybridClassRegistry::registerHybridClass("navigation.NavigationScreen", HybridNavigationScreenSpecSwift::Class::get());
|
|
20
|
+
HybridClassRegistry::registerHybridClass("navigation.NavigationStack", HybridNavigationStackSpecSwift::Class::get());
|
|
21
|
+
}
|
|
22
|
+
} // namespace margelo::nitro::navigation
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ReactNitroNavigationAutolinking.mm
|
|
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
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#include <ReactNitroNavigation/ReactNitroNavigationAutolinking.hpp>
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Registers all HybridObject classes of ReactNitroNavigation
|
|
13
|
+
* when the app loads, so JS can look them up by name.
|
|
14
|
+
*/
|
|
15
|
+
@interface ReactNitroNavigationAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation ReactNitroNavigationAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void)load {
|
|
21
|
+
margelo::nitro::navigation::registerHybridClasses();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridNavigationScreenSpecSwift.cpp
|
|
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
|
+
#include <ReactNitroNavigation/private/HybridNavigationScreenSpecSwift.hpp>
|
|
9
|
+
#include <NitroModules/SwiftConverter.hpp>
|
|
10
|
+
#include <NitroModules/SwiftResult.hpp>
|
|
11
|
+
#include <optional>
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::navigation {
|
|
14
|
+
|
|
15
|
+
std::string HybridNavigationScreenSpecSwift::toString() {
|
|
16
|
+
return SwiftConverter<std::string, swift::String>::fromSwift(_swiftPart.toString());
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Properties
|
|
20
|
+
|
|
21
|
+
::ReactNitroRenderer::HybridViewControllerSpec_cxx HybridNavigationScreenSpecSwift::getViewController() {
|
|
22
|
+
return _swiftPart.getViewController();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
swift::Optional<swift::String> HybridNavigationScreenSpecSwift::getTitle() {
|
|
26
|
+
return _swiftPart.getTitle();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
void HybridNavigationScreenSpecSwift::setTitle(const swift::Optional<swift::String>& title) {
|
|
30
|
+
return _swiftPart.setTitle(title);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Methods
|
|
34
|
+
|
|
35
|
+
// Constructor
|
|
36
|
+
|
|
37
|
+
::ReactNitroNavigation::HybridNavigationScreenSpec_cxx HybridNavigationScreenSpecSwift::constructor() {
|
|
38
|
+
auto __result = ::ReactNitroNavigation::HybridNavigationScreenSpec_cxx::constructor();
|
|
39
|
+
if (__result.hasError()) [[unlikely]] {
|
|
40
|
+
std::rethrow_exception(__result.error());
|
|
41
|
+
}
|
|
42
|
+
return ::ReactNitroNavigation::HybridNavigationScreenSpec_cxx::fromUnsafe(__result.value());
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const std::shared_ptr<const HybridClass>& HybridNavigationScreenSpecSwift::Class::get() {
|
|
46
|
+
static const auto hybridClass = HybridClass::create<Class>([](HybridClass& clazz) {
|
|
47
|
+
clazz.registerHybridProperty("viewController", &HybridNavigationScreenSpecSwift::getViewController);
|
|
48
|
+
clazz.registerHybridProperty("title", &HybridNavigationScreenSpecSwift::getTitle, &HybridNavigationScreenSpecSwift::setTitle);
|
|
49
|
+
clazz.registerHybridConstructor(&HybridNavigationScreenSpecSwift::constructor);
|
|
50
|
+
});
|
|
51
|
+
return hybridClass;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::navigation
|