-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release 1.0.0 #1
Draft
maximkrouk
wants to merge
43
commits into
main
Choose a base branch
from
navigation-stacks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Major API improvements - Replace `configureRoutes` with `navigationDestination` - Implement `navigationStack` - Get rid of `RouteConfiguration` API - Draft README.md update
- Add navigationAnimation API - Improve routes mapping API - Add Destination wrapper for child controllers - Add RoutingController macro and RoutingControllerProtocol - Make mapping optional for navigationDestinations for state-based dismissal - Generalize configuration API by removing labels for publishers - Add tests - Destination Wrapper - RoutingController macro - RoutingControllerProtocol - Add todo warnings
- Add Publisher.withNavigationAnimation() - Fix navigationStack todo - Add StackDestination wrapper - Add destinations mapper for stacks - API Improvements: - Add withoutNavigationAnimation functions - Rename RoutingControllerProtocol to RoutingController - Tests - Add StackDestinationTests - Update TreeDestinationTests - Add RoutingControllerTests.testAnimation - Add RoutingControllerTests.testAnimationPublisher - Add RoutingControllerTests.testNavigationStackDestinations - Update RoutingControllerTests - Update RoutingControllerMacroTests - Infrastructure improvements - Setup CI - Add workflow - Add Makefile - Add SPI docs - Cleanup project structure - Minor Readme update - Remove resolved todos and unused code [ci skip]
- Optimizations: - Destinations now use strong references to controllers and explicitly removes those references when controllers are popped from the navigation stack, no more just-in-case cleanups in StackDestination on each wrappedValue access - API Improvements - With new navigationStack/Destination methods controllers can be implicitly instantiated from Destination wrappers, all users have to do is provide mappings from Route to a corresponding destination
maximkrouk
force-pushed
the
navigation-stacks
branch
from
December 19, 2023 02:54
f12c12c
to
844dd5e
Compare
- Use `composable-navigation-extensions` branch `observation-beta` - Start basic modularization
- Use CasePaths reflection to get rid of Route hashability constraint for navigationDestinations - Get rid of redundant Hashable conformance of Route in navigationStacks - Get rid of CombineExtensions dependency
Additional changes: - Improve tests - Update ci.yml - Refactor Destination APIs - Refactor project structure - Update README.md
Always present controllers on navigationGroupRoot
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reactive navigation in UIKit has always been challenging, but not anymore (hopefully). With the help of swift macros and property wrappers this release introduces a set of tools that make setting up reactive navigation a breeze.
Usage
Stack navigation
For the stacknavigation there is a
UIViewController.navigationStack
method, which accepts a collection of destination states, maps them to controllers and provides you with a dismiss handler.Use
@StackDestination
property wrapper to declare a factory for each of available destination types,@RoutingController
macro will generateRoutingController
conformance for your controller.The
RoutingController
protocol provides conveniencedestinations
methods for mapping states to controllers. To provide those methodsRoutingController
protocol requires theDestinations
type, which is generated by the @RoutingController macro. Thedestinations
method uses the _makeDestinations()
method of the protocol (which is also generated) internally to create a Destinations instance. This ensures that your factories are safely captured without accidentally capturing self.@StackDestination
weakly captures all presented controllers and is able to return existing controller if present or create a new one conditionally on demand.Lets take a look at the example for
it's not required to create
Tag
enum forDestinationState
, but this way we'll be able to reduce the amount of updates withremoveDuplicates()
publisher.Tree navigation
For the tree navigation there is a
UIViewController.navigationDestination
method, which accepts a publisher of destination state (or booleanisPresented
publisher), maps route to controller (or nil for dismissed state) and provides you with a dismiss handler.Use
@TreeDestination
property wrapper to declare a factory for each of available destination types,@RoutingController
macro will generateRoutingController
conformance for your controller.The
RoutingController
protocol provides conveniencedestinations
methods for mapping states to controllers for tree destinations as well.@TreeDestination
weakly captures presented controller and is able to return existing controller if present or create a new one conditionally on demand.Lets take a look at the example for
it's not required to create
Tag
enum forDestination
, but this way we'll be able to reduce the amount of updates withremoveDuplicates()
publisher as well as for the stack navigation.NavigationAnimation
You can disable animations for state updates by wrapping them into
withoutNavigationAnimation { ... }
functions or if those updates are published like it's done in TCA you can use.withoutNavigationAnimation()
operator for publisher, just make sure that handler will be called on the main thread (in TCA you simply should use this operator at the end of the Effect chain and erase it back to Effect)