Skip to content

Commit

Permalink
✨ :: [#72] SplashFeature / SplashFactory 및 SplashFeature 사전세팅
Browse files Browse the repository at this point in the history
  • Loading branch information
baekteun committed Jul 23, 2023
1 parent 666e6a1 commit c7f6c24
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import BaseFeature
import UIKit

public protocol SplashFactory {
func makeViewController() -> any StoredViewControllable
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import AuthDomainInterface
import BaseFeature
import UIKit

final class SplashFactoryImpl: SplashFactory {
private let checkIsLoggedInUseCase: any CheckIsLoggedInUseCase

init(checkIsLoggedInUseCase: any CheckIsLoggedInUseCase) {
self.checkIsLoggedInUseCase = checkIsLoggedInUseCase
}

func makeViewController() -> any StoredViewControllable {
let store = SplashStore(checkIsLoggedInUseCase: checkIsLoggedInUseCase)
return SplashViewController(store: store)
}
}
32 changes: 32 additions & 0 deletions Projects/Feature/SplashFeature/Sources/Scene/SplashStore.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import AuthDomainInterface
import BaseFeature
import Combine
import Moordinator
import Store

final class SplashStore: BaseStore {
var route: PassthroughSubject<RoutePath, Never> = .init()
var subscription: Set<AnyCancellable> = .init()
var initialState: State
var stateSubject: CurrentValueSubject<State, Never>
private let checkIsLoggedInUseCase: any CheckIsLoggedInUseCase

init(checkIsLoggedInUseCase: any CheckIsLoggedInUseCase) {
initialState = .init()
stateSubject = .init(initialState)
self.checkIsLoggedInUseCase = checkIsLoggedInUseCase
}

struct State {}
enum Action {}
enum Mutation {}

func mutate(state: State, action: Action) -> SideEffect<Mutation, Never> {
.none
}

func reduce(state: State, mutate: Mutation) -> State {
var newState = state
return newState
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import BaseFeature
import UIKit

final class SplashViewController: BaseViewController<SplashStore> {
}
1 change: 0 additions & 1 deletion Projects/Feature/SplashFeature/Sources/Source.swift

This file was deleted.

0 comments on commit c7f6c24

Please sign in to comment.