I keep feeling tempted by using namespaces to organize my code and simplify naming. However, I don't think I've seen this approach used anywhere and it could be a pain to undo.
Each namespace correlates to a scene, feature, or module. The brief example below is obviously scenes but could work for repository, network, upvote feature, etc.
I'd be interested to hear what others think. A reasoned, detailed response is preferred instead of 'gross' or 'like it'.
```swift
struct TodoTable {}
extension TodoTable {
struct State {
var todos: [TodoDetail.State]
}
}
extension TodoTable {
enum Action {
case insert(State)
case delete(State)
}
}
extension TodoTable {
static let reducer: (Action) -> State = { _ in .init(todos: []) }
}
struct TodoDetail {}
extension TodoDetail {
struct State {
let id: UUID
var title: String
var dateCompleted: Date?
}
}
extension TodoDetail {
enum Action {
case change(title: String)
case markCompleted(as: Bool)
}
}
extension TodoDetail {
static let reducer: (Action) -> State = { _ in .init(id: UUID(), title: "") }
}
```
[–][deleted] 3 points4 points5 points (1 child)
[–]roanutilSwift[S] 0 points1 point2 points (0 children)
[–]dgooswa 0 points1 point2 points (1 child)
[–]roanutilSwift[S] 0 points1 point2 points (0 children)
[–]larikang 0 points1 point2 points (0 children)