diff --git a/Projects/Feature/MusicFeature/Sources/Factory/MusicFactoryImpl.swift b/Projects/Feature/MusicFeature/Sources/Factory/MusicFactoryImpl.swift index ab771242..62307efd 100644 --- a/Projects/Feature/MusicFeature/Sources/Factory/MusicFactoryImpl.swift +++ b/Projects/Feature/MusicFeature/Sources/Factory/MusicFactoryImpl.swift @@ -2,6 +2,8 @@ import Moordinator struct MusicFactoryImpl: MusicFactory { func makeMoordinator() -> Moordinator { - MusicMoordinator() + let store = MusicStore() + let viewController = MusicViewController(store: store) + return MusicMoordinator(musicViewController: viewController) } } diff --git a/Projects/Feature/MusicFeature/Sources/Moordinator/MusicMoordinator.swift b/Projects/Feature/MusicFeature/Sources/Moordinator/MusicMoordinator.swift index 48dce403..52228d23 100644 --- a/Projects/Feature/MusicFeature/Sources/Moordinator/MusicMoordinator.swift +++ b/Projects/Feature/MusicFeature/Sources/Moordinator/MusicMoordinator.swift @@ -5,11 +5,15 @@ import UIKit final class MusicMoordinator: Moordinator { private let rootVC = UINavigationController() - + private let musicViewController: any StoredViewControllable var root: Presentable { rootVC } + init(musicViewController: any StoredViewControllable) { + self.musicViewController = musicViewController + } + func route(to path: RoutePath) -> MoordinatorContributors { guard let path = path.asDotori else { return .none } switch path { @@ -25,8 +29,12 @@ final class MusicMoordinator: Moordinator { private extension MusicMoordinator { func coordinateToMusic() -> MoordinatorContributors { - let musicWebViewController = DWebViewController(urlString: "https://www.dotori-gsm.com/song") - self.rootVC.setViewControllers([musicWebViewController], animated: true) - return .none + self.rootVC.setViewControllers([self.musicViewController], animated: true) + return .one( + .contribute( + withNextPresentable: self.musicViewController, + withNextRouter: self.musicViewController.store + ) + ) } } diff --git a/Projects/Feature/MusicFeature/Sources/Scene/MusicStore.swift b/Projects/Feature/MusicFeature/Sources/Scene/MusicStore.swift new file mode 100644 index 00000000..0fd1b0a5 --- /dev/null +++ b/Projects/Feature/MusicFeature/Sources/Scene/MusicStore.swift @@ -0,0 +1,33 @@ +import BaseFeature +import Combine +import Store +import Moordinator + +final class MusicStore: BaseStore { + var route: PassthroughSubject = .init() + var subscription: Set = .init() + var initialState: State + var stateSubject: CurrentValueSubject + + init() { + self.initialState = .init() + self.stateSubject = .init(initialState) + } + + struct State {} + enum Action {} + enum Mutation {} +} + +extension MusicStore { + func mutate(state: State, action: Action) -> SideEffect { + .none + } +} + +extension MusicStore { + func reduce(state: State, mutate: Mutation) -> State { + var newState = state + return newState + } +} diff --git a/Projects/Feature/MusicFeature/Sources/Scene/MusicViewController.swift b/Projects/Feature/MusicFeature/Sources/Scene/MusicViewController.swift new file mode 100644 index 00000000..84e1aad8 --- /dev/null +++ b/Projects/Feature/MusicFeature/Sources/Scene/MusicViewController.swift @@ -0,0 +1,4 @@ +import BaseFeature + +final class MusicViewController: BaseStoredViewController { +}