From a52e55674f1e1a132ae06bb63ca11b9f16c69ab8 Mon Sep 17 00:00:00 2001 From: Robert Dresler Date: Sun, 19 Jan 2025 18:28:10 +0100 Subject: [PATCH] Fix creating nodes in body of windows + update READMEs --- .../Examples/Examples/Windows/AppWindow.swift | 16 +++++++++----- .../Examples/Windows/WaitingWindow.swift | 14 ++++++++---- Examples/Examples/README.md | 22 +++++++++++++++++++ README.md | 4 ++-- 4 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 Examples/Examples/README.md diff --git a/Examples/Examples/Examples/Windows/AppWindow.swift b/Examples/Examples/Examples/Windows/AppWindow.swift index 09b41a4..9fb1400 100644 --- a/Examples/Examples/Examples/Windows/AppWindow.swift +++ b/Examples/Examples/Examples/Windows/AppWindow.swift @@ -7,16 +7,22 @@ import Shared struct AppWindow: View { @Environment(\.requestReview) private var requestReview + @ObservedObject private var rootNode: NavigationNode var dependencies: Dependencies + init(dependencies: Dependencies) { + self.dependencies = dependencies + self.rootNode = AppNavigationNode( + flagsRepository: dependencies.flagsRepository, + deepLinkForwarderService: dependencies.deepLinkForwarderService, + onboardingService: dependencies.onboardingService + ) + } + var body: some View { NavigationWindow( - rootNode: AppNavigationNode( - flagsRepository: dependencies.flagsRepository, - deepLinkForwarderService: dependencies.deepLinkForwarderService, - onboardingService: dependencies.onboardingService - ), + rootNode: rootNode, defaultDeepLinkHandler: dependencies.defaultDeepLinkHandler ) .registerCustomPresentableNavigationNodes([PhotosPickerPresentedNavigationNode.self]) diff --git a/Examples/Examples/Examples/Windows/WaitingWindow.swift b/Examples/Examples/Examples/Windows/WaitingWindow.swift index 2c59cd8..f2c8eab 100644 --- a/Examples/Examples/Examples/Windows/WaitingWindow.swift +++ b/Examples/Examples/Examples/Windows/WaitingWindow.swift @@ -5,14 +5,20 @@ import ExamplesNavigation struct WaitingWindow: View { + @ObservedObject private var rootNode: NavigationNode var dependencies: Dependencies + init(dependencies: Dependencies) { + self.dependencies = dependencies + self.rootNode = WaitingNavigationNode( + inputData: WaitingInputData(), + flagsRepository: dependencies.flagsRepository + ) + } + var body: some View { NavigationWindow( - rootNode: WaitingNavigationNode( - inputData: WaitingInputData(), - flagsRepository: dependencies.flagsRepository - ), + rootNode: rootNode, defaultDeepLinkHandler: dependencies.defaultDeepLinkHandler ) } diff --git a/Examples/Examples/README.md b/Examples/Examples/README.md new file mode 100644 index 0000000..360cf54 --- /dev/null +++ b/Examples/Examples/README.md @@ -0,0 +1,22 @@ +# Examples + +## Getting Started + +1. Have you downloaded the repo? Make sure to **rename** the downloaded folder to `SwiftUINavigation` + +2. Open the app at path `SwiftUINavigation/Examples/Examples.xcodeproj` + +3. Run the app + + - On simulator + - On a real device (set your development team) + +4. Explore the app + +## Documentation + +For the full documentation, refer to `SwiftUINavigation/README.md` or visit the [GitHub repo](https://github.com/RobertDresler/SwiftUINavigation). + +## Issues + +If you encounter any bugs or have a feature request, feel free to open an issue or a pull request in the repo. diff --git a/README.md b/README.md index 4adfacc..ced1d03 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,8 @@ I highly recommend starting by exploring the Examples app. The app features many To get started, first add the package to your project: -- In Xcode, add the package by using this URL: `https://github.com/RobertDresler/SwiftUINavigation` and choose the dependency rule **up to next major version** from `1.0.2` -- Alternatively, add it to your `Package.swift` file: `.package(url: "https://github.com/RobertDresler/SwiftUINavigation", from: "1.0.2")` +- In Xcode, add the package by using this URL: `https://github.com/RobertDresler/SwiftUINavigation` and choose the dependency rule **up to next major version** from `1.0.3` +- Alternatively, add it to your `Package.swift` file: `.package(url: "https://github.com/RobertDresler/SwiftUINavigation", from: "1.0.3")` Once the package is added, you can copy this code and begin exploring the framework by yourself: