Skip to content
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

๐Ÿ”€ :: Navigator ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์ธ์ฒ™ํ•˜๋Š” Coordinator ๋ฐฉ์‹ ๋ณ€๊ฒฝ #5

Merged
merged 2 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ public extension TargetDependency.Feature {
target: ModulePaths.Feature.MainFeature.targetName(type: .sources),
path: .relativeToFeature(ModulePaths.Feature.MainFeature.rawValue)
)
static let RootFeatureInterface = TargetDependency.project(
target: ModulePaths.Feature.RootFeature.targetName(type: .interface),
path: .relativeToFeature(ModulePaths.Feature.RootFeature.rawValue)
)
static let RootFeature = TargetDependency.project(
target: ModulePaths.Feature.RootFeature.targetName(type: .sources),
path: .relativeToFeature(ModulePaths.Feature.RootFeature.rawValue)
Expand Down
16 changes: 16 additions & 0 deletions Projects/Feature/BaseFeature/Sources/DotoriRoutePath.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Moordinator

public enum DotoriRoutePath: RoutePath {
case splash
case signin
case signup
case findID
case renewalPassword
case main
}

public extension RoutePath {
var asDotori: DotoriRoutePath? {
self as? DotoriRoutePath
}
}
5 changes: 0 additions & 5 deletions Projects/Feature/MainFeature/Interface/MainRoutePath.swift

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import BaseFeature
import Combine
import MainFeatureInterface
import Moordinator

final class MainRouter: Router {
let route: PassthroughSubject<any RoutePath, Never> = .init()
var initialPath: RoutePath {
MainRoutePath.main
DotoriRoutePath.main
}
}
6 changes: 0 additions & 6 deletions Projects/Feature/RootFeature/Interface/RootRoutePath.swift

This file was deleted.

2 changes: 1 addition & 1 deletion Projects/Feature/RootFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import DependencyPlugin
let project = Project.makeModule(
name: ModulePaths.Feature.RootFeature.rawValue,
product: .staticLibrary,
targets: [.interface],
targets: [],
internalDependencies: [
.Feature.SigninFeatureInterface,
.Feature.MainFeatureInterface,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import BaseFeature
import Combine
import MainFeatureInterface
import Moordinator
import RootFeatureInterface
import SigninFeatureInterface
import UIKit

Expand Down Expand Up @@ -33,9 +33,9 @@ public final class RootMoordinator: Moordinator {
}

public func route(to path: RoutePath) -> MoordinatorContributors {
guard let path = path as? RootRoutePath else { return .none }
guard let path = path.asDotori else { return .none }
switch path {
case .auth:
case .signin:
let signinMoordinator = signinFactory.makeMoordinator()
Moord.use(signinMoordinator) { root in
self.window.rootViewController = root
Expand All @@ -62,6 +62,9 @@ public final class RootMoordinator: Moordinator {
)
}
return .one(.contribute(mainMoordinator))

default:
return .none
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import BaseFeature
import Combine
import Moordinator
import RootFeatureInterface

final class RootRouter: Router {
let route: PassthroughSubject<any RoutePath, Never> = .init()
var initialPath: RoutePath {
RootRoutePath.auth
DotoriRoutePath.signin
}
}

This file was deleted.

1 change: 0 additions & 1 deletion Projects/Feature/SigninFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ let project = Project.makeModule(
targets: [.interface, .unitTest],
internalDependencies: [
.Feature.BaseFeature,
.Feature.RootFeatureInterface,
.Feature.SignupFeatureInterface,
.Feature.RenewalPasswordFeatureInterface,
.Domain.AuthDomainInterface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import BaseFeature
import DesignSystem
import Moordinator
import RenewalPasswordFeatureInterface
Expand Down Expand Up @@ -30,7 +31,7 @@ final class SigninMoordinator: Moordinator {
}

func route(to path: RoutePath) -> MoordinatorContributors {
guard let path = path as? SigninRoutePath else { return .none }
guard let path = path.asDotori else { return .none }
switch path {
case .signin:
rootVC.setViewControllers([signinViewController], animated: true)
Expand All @@ -46,7 +47,7 @@ final class SigninMoordinator: Moordinator {
return .one(.contribute(viewController))

case .main:
return .one(.forwardToParent(with: RootRoutePath.main))
return .one(.forwardToParent(with: DotoriRoutePath.main))

default:
return .none
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import BaseFeature
import Combine
import SigninFeatureInterface
import Moordinator

final class SigninRouter: Router {
let route: PassthroughSubject<any RoutePath, Never> = .init()
var initialPath: RoutePath {
SigninRoutePath.signin
DotoriRoutePath.signin
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ final class SigninStore: BaseStore, RouterProvidable {
newState.password = password

case .signupButtonDidTap:
router.route.send(SigninRoutePath.signup)
router.route.send(DotoriRoutePath.signup)

case .renewalPasswordButtonDidTap:
router.route.send(SigninRoutePath.renewalPassword)
router.route.send(DotoriRoutePath.renewalPassword)

case .signinButtonDidTap:
signinButtonDidTap(email: newState.email, password: newState.password)
Expand All @@ -64,7 +64,7 @@ final class SigninStore: BaseStore, RouterProvidable {
DotoriToast.makeToast(text: err.errorDescription, style: .error)
}
}, receiveValue: { owner, _ in
owner.router.route.send(SigninRoutePath.main)
owner.router.route.send(DotoriRoutePath.main)
})
.store(in: &bag)
}
Expand Down