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

탭바 설정 #3

Merged
merged 12 commits into from
Mar 5, 2024

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions Projects/App/Resources/Assets.xcassets/Contents.json

This file was deleted.

1 change: 0 additions & 1 deletion Projects/App/Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Then
import Presentation
import Domain
import Core
import DesignSystem

@main
final class AppDelegate: UIResponder, UIApplicationDelegate {
Expand Down
5 changes: 5 additions & 0 deletions Projects/Core/Sources/Steps/Tabs/ChatStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import RxFlow

public enum ChatStep: Step {
case chatIsRequired
}
5 changes: 5 additions & 0 deletions Projects/Core/Sources/Steps/Tabs/FriendsStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import RxFlow

public enum FriendsStep: Step {
case friendsIsRequired
}
5 changes: 5 additions & 0 deletions Projects/Core/Sources/Steps/Tabs/MyPageStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import RxFlow

public enum MyPageStep: Step {
case myPageIsRequired
}
5 changes: 5 additions & 0 deletions Projects/Core/Sources/Steps/Tabs/StoreStep.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import RxFlow

public enum StoreStep: Step {
case storeIsRequired
}
21 changes: 10 additions & 11 deletions Projects/Flow/Sources/AppFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,17 @@ private extension AppFlow {
}

func navigationToTab() -> FlowContributors {
let mainViewController = container.resolve(MainViewController.self)!
UIView.transition(
with: self.window,
duration: 0.5,
options: .transitionCrossDissolve
) {
self.window.rootViewController = mainViewController
let tabsFlow = TabsFlow(container: container)
Flows.use(
tabsFlow,
when: .created
) { [weak self] root in
self?.window.rootViewController = root
}

return .one(flowContributor: .contribute(
withNextPresentable: mainViewController,
withNextStepper: mainViewController.reactor
))
withNextPresentable: tabsFlow,
withNextStepper: OneStepper(withSingleStep: AppStep.tabIsRequired)
)
)
}
}
39 changes: 39 additions & 0 deletions Projects/Flow/Sources/ChatFlow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import UIKit
import RxFlow
import RxSwift
import Core
import Swinject
import Presentation

public final class ChatFlow: Flow {

public let container: Container
private let rootViewController = BaseNavigationController()

public var root: Presentable {
return rootViewController
}

init(container: Container) {
self.container = container
}

public func navigate(to step: RxFlow.Step) -> RxFlow.FlowContributors {
guard let step = step as? ChatStep else { return .none }
switch step {
case .chatIsRequired:
return navigateToChat()
}
}
}

extension ChatFlow {
private func navigateToChat() -> FlowContributors {
let chatViewController = container.resolve(ChatViewController.self)!
self.rootViewController.pushViewController(chatViewController, animated: false)
return .one(flowContributor: .contribute(
withNextPresentable: chatViewController,
withNextStepper: chatViewController.reactor
))
}
}
40 changes: 40 additions & 0 deletions Projects/Flow/Sources/FriendsFlow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import UIKit
import RxFlow
import RxSwift
import Core
import Swinject
import Presentation

public final class FriendsFlow: Flow {

public let container: Container
private let rootViewController = BaseNavigationController()

public var root: Presentable {
return rootViewController
}

init(container: Container) {
self.container = container
}

public func navigate(to step: RxFlow.Step) -> RxFlow.FlowContributors {
guard let step = step as? FriendsStep else { return .none }
switch step {
case .friendsIsRequired:
return navigateToFriends()
}
}
}

extension FriendsFlow {
private func navigateToFriends() -> FlowContributors {
let friendsViewController = container.resolve(FriendsViewController.self)!
self.rootViewController.pushViewController(friendsViewController, animated: false)
return .one(flowContributor: .contribute(
withNextPresentable: friendsViewController,
withNextStepper: friendsViewController.reactor
))
}

}
39 changes: 39 additions & 0 deletions Projects/Flow/Sources/MyPageFlow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import UIKit
import RxFlow
import RxSwift
import Core
import Swinject
import Presentation

public final class MyPageFlow: Flow {

public let container: Container
private let rootViewController = BaseNavigationController()

public var root: Presentable {
return rootViewController
}

init(container: Container) {
self.container = container
}

public func navigate(to step: RxFlow.Step) -> RxFlow.FlowContributors {
guard let step = step as? MyPageStep else { return .none }
switch step {
case .myPageIsRequired:
return presentMyPage()
}
}
}

extension MyPageFlow {
private func presentMyPage() -> FlowContributors {
let myPageViewController = container.resolve(MyPageViewController.self)!
self.rootViewController.pushViewController(myPageViewController, animated: false)
return .one(flowContributor: .contribute(
withNextPresentable: rootViewController,
withNextStepper: myPageViewController.reactor
))
}
}
39 changes: 39 additions & 0 deletions Projects/Flow/Sources/StoreFlow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import UIKit
import RxFlow
import RxSwift
import Core
import Swinject
import Presentation

public final class StoreFlow: Flow {

public let container: Container
private let rootViewController = BaseNavigationController()

public var root: Presentable {
return rootViewController
}

init(container: Container) {
self.container = container
}

public func navigate(to step: RxFlow.Step) -> RxFlow.FlowContributors {
guard let step = step as? StoreStep else { return .none }
switch step {
case .storeIsRequired:
return navigateToStore()
}
}
}

extension StoreFlow {
private func navigateToStore() -> FlowContributors {
let storeViewController = container.resolve(StoreViewController.self)!
self.rootViewController.pushViewController(storeViewController, animated: false)
return .one(flowContributor: .contribute(
withNextPresentable: storeViewController,
withNextStepper: storeViewController.reactor
))
}
}
Loading