Comments (3)
More Swifty router implemented in PR #25. Instead of segues
, use the extended show
API with completion handler for configuring target view controller:
class ListOrdersRouter: NSObject, RouterProtocol,...
{
func routeToShowOrder(for id: String)
{
show(storyboard: .showOrder) { (destinationVC: ShowOrderViewController) in
let selectedOrder = self.dataStore?.orders?.first { $0.id == id }
var destinationDS = destinationVC.router!.dataStore!
self.passDataToShowOrder(for: selectedOrder, destination: &destinationDS)
}
}
func routeToCreateOrder()
{
show(storyboard: .createOrder) { (destinationVC: CreateOrderViewController) in
var destinationDS = destinationVC.router!.dataStore!
self.passDataToCreateOrder(source: self.dataStore!, destination: &destinationDS)
}
}
Also, each scene has its own storyboard instead of placed all in one main storyboard:
Let me know what you think.
from cleanstore.
Hey, the changes are very nice. Separate storyboards for each unique scene is the way to go. However the router class itself is still not swifty. Swift is a protocol and extension orientated language, so having a class with 2 methods and a weak property to the VC is clunky. Itβs also a memory leaker if weak is forgot as the VC is also referencing the rooter class. That whole class for example could easily just be a extension of the view controller, optionally in a new swift file. I am just pointing this out as I feel clean architecture is outdated for Swift, especially they way most tutorials and the cleanSwift website do it. Thanks for your detailed reply and your awesome repo.
from cleanstore.
Cool thx for taking a look and the feedback. I definitely agree with all your points.
I have another repo called stateless_arch
where all parts are value-type structs instead of classes. My thought is the architectural flow should be stateless and immutable, with the exception of the view controller of course. That should be safer, simpler to think about, and in the spirit of Swift philosophy. Itβs a bit of work so still chipping away at it.
from cleanstore.
Related Issues (20)
- CoreData not working? HOT 1
- Question on Usage : Reload TableView
- Expanding example - Delete user?
- How about swift 3 support ? HOT 6
- Testing viewDidLoad without using Storyboards HOT 1
- Container View Controller Data passing HOT 2
- Clean Junk HOT 2
- passing data from interactor to worker
- Latest codes is not in consistence with what's in the blog HOT 4
- Storyboard and nib-less?
- Build is failing
- Question: Worker best practise network+core data HOT 2
- Why tested protocols are suffixed by Spy and not Mock ?
- C
- Clean Swift Refactoring
- Clean swift
- make install command is not working on M1...
- Question: Should the data source of the router be an interactor or a presenter? HOT 1
- OC version HOT 1
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 cleanstore.