Comments (2)
It's not that simple, sadly.
If parentCoordinator has, say 2 child Coordinators, and second one is popped, maybe the 1st child should take ownership, not the parent. And maybe not, it really depends on the app.
(Only if no child Coordinators are left then parent Coordinator should take ownership.)
This is related to #10 and same as there – I don't see a straight-forward solution that works in all cases.
Coordinator is deliberatelly made simple to cover just the basics. Dealing with logic like this is something that app should decide in its own subclass of NavigationCoordinator – only in the context of the specific app a decision can be made what should happen is particular Coordinator instance is stopped.
Example for the shop app I used as demo: say
- You are on CatalogCoordinator and want to buy something
- You tap on Buy now
- This is routed up to the CatalogCoordinator which then checks with AccountManager are you logged in
- If not, it pushes AccountCoordinator to show LoginVC
- When login is done, it could return you to CatalogCoordinator and you tap Buy now again but...
- it's better if it would just continue the flow and push PaymentCoordinator
That's why I don't think this is something that library should decide on its own – it's app developer's job.
from coordinator.
Compared with the code ,add the judgement logic here .I think it's a great design to reduce the bugs.We should know when we must relinquish the delegate completely ,so that's the difference between the code. @radianttap Thank for your sharing and contribution ....
open override func stop(with completion: @escaping () -> Void) {
rootViewController.delegate = nil
for vc in viewControllers {
guard let index = rootViewController.viewControllers.index(of: vc) else { continue }
rootViewController.viewControllers.remove(at: index)
}
viewControllers.removeAll()
super.stop(with: completion)
}
from coordinator.
Related Issues (20)
- Declarations from extensions cannot be overridden yet HOT 6
- Rewinding state after stop/stopChild HOT 4
- Track `popViewController` when user taps Back bar button on iOS >= 10 HOT 6
- Support Carthage HOT 8
- Support Swift Package manager HOT 2
- Add shields.io badges
- Non-animated pop is not detected in NavigationCoordinator HOT 5
- Bloated Namespace HOT 1
- Unable to compile CoordinatorExample.xcodeproj HOT 2
- [Refactor] :Make code clean HOT 6
- How to compile and run the example app? HOT 1
- Cocoapods error HOT 2
- handlePopBack is not called when 2 coordinators share the same rootViewController HOT 3
- Tutorial request - A sample xcproject? HOT 1
- Crash on Accessing Parent Coordinator HOT 3
- Can't use Struct as params in UIResponder's method HOT 1
- Bubbling events in the responder chain HOT 4
- Track Dismissal of RootViewController HOT 3
- UITabBarController as Root or Child Coordinator HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coordinator.