wearereasonablepeople / rerouter Goto Github PK
View Code? Open in Web Editor NEWRouting with ReactiveReSwift and RxSwift
License: MIT License
Routing with ReactiveReSwift and RxSwift
License: MIT License
Path
equalityPath
common lengthRouterHandler
add pathThe problem with tabbar is that it's basically combination of paths in each tab with one tab selected. We need to explore a way of making smart path for tabbar
We need to have a way of using router URL to handle deep linking. The first possible approach would be to provide a dictionary [URL: Path<Root>]
. However, we need to have a way of extracting the parameters from the URL.
Almost all the operations on the path now take O(n)
time because it's based on the array.
We need RxSwift, because Router
internally uses it to listen to changes in the path. However, it would be great to make it FRP frameworks ignorant. For this, we will need some basic streams functionality within the router.
Some things appear all the time, so we can make them as static functions on the NavigationItem
. This issue will have subtasks for each specific implementation
Now all the transitions are animated. However, we need to have rules for determining whether the transition is animated or not
RouteHandler add path crashes if paths are same and the last NavigationItem's target is not Coordinator
Now error messages are really confusing, as they don't give much information about what has happened. One of the examples is the wrong identifier. We could provide more information of which identifier we expected and which we actually got
Basically, we do double work when we do distinctUntilChanged
as we after that create the RouteChange
that does pretty much the same thing. So we do the same work twice. Instead, we could use the RouteChange
and filter for it to be non-empty, as it takes O(1)
time
Now it's really not very clear how to use the library only from documentation, so it would be great to create a demo app for this purpose
So silent paths are implemented, but the have never been documented. We need to do that
I get the following output while trying to compile using Carthage:
*** Building scheme "ReRouter" in ReRouter.xcodeproj
Build Failed
Task failed with exit code 65:
/usr/bin/xcrun xcodebuild -project /.../Carthage/Checkouts/ReRouter/ReRouter.xcodeproj -scheme ReRouter -configuration Release -derivedDataPath ~/Library/Caches/org.carthage.CarthageKit/DerivedData/10.0_10A255/ReRouter/0.1.0 -sdk iphoneos ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath /var/folders/ns/0h9r9v5908x4x67v5j9wvhvw0000gn/T/ReRouter SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO STRIP_INSTALLED_PRODUCT=NO (launched in /.../Carthage/Checkouts/ReRouter)
This usually indicates that project itself failed to compile.
My iOS Simulator keeps crashing throwing the following error:
ReRouter was compiled with optimization - stepping may behave oddly;
variables may not be available.
Can you please update the dependencies? Especially RxSwift
to 4.0
?
Some route changes are initiated silently by UIKit
. Like when you push back button on the navigation controller. That is why we need to have a way for router to ignore some changes
Add presentViewController presentation for Coordinators that store view controllers
In my environment ReRouter v0.1 throws this error, pointing to the following function:
func add(path: Path<Root.Key>, same: Int) -> [NavigationItem] {
let initial = same > 0 ? items[same - 1].target : AnyCoordinator(root)
var result = [NavigationItem]()
_ = path.sequence[same..<path.sequence.count]
.lazy.map(AnyIdentifier.init)
.reduce(initial, { (item, current) in
let new = (item as! AnyCoordinator).item(for: current) //<---- the error is thrown here
result.append(new)
return new.target
})
return result
}
And here is the code which does the navigation:
func item(for key: Key) -> NavigationItem{
switch key{
case .list:
let viewController = ListViewController(style: .grouped)
viewController.store = self.store
return NavigationItem(self, viewController, push: { (animated, source, target, completion) in
source.controller.pushViewController(target, animated: animated)
completion()
}, pop: { (animated, source, target, completion) in
source.controller.popViewController(animated: animated)
completion()
})
case .new,.edit,.myCard:
let viewController = FormViewController()
viewController.store = self.store
return NavigationItem(self, viewController, push: { (animated, source, target, completion) in
source.controller.pushViewController(target, animated: animated)
completion()
}, pop: { (animated, source, target, completion) in
source.controller.popViewController(animated: animated)
completion()
})
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.