From 7510440cc761413a21ce0330b9371641d4020a11 Mon Sep 17 00:00:00 2001 From: unnnyong Date: Wed, 10 Jun 2020 18:22:20 +0900 Subject: [PATCH] add OffGame RIB files --- .../RIBsPractice/OffGame/OffGameBuilder.swift | 34 +++++++++++++++++++ .../OffGame/OffGameInteractor.swift | 30 ++++++++++++++++ .../RIBsPractice/OffGame/OffGameRouter.swift | 25 ++++++++++++++ .../OffGame/OffGameViewController.storyboard | 28 +++++++++++++++ .../OffGame/OffGameViewController.swift | 18 ++++++++++ 5 files changed, 135 insertions(+) create mode 100644 RIBsPractice/RIBsPractice/OffGame/OffGameBuilder.swift create mode 100644 RIBsPractice/RIBsPractice/OffGame/OffGameInteractor.swift create mode 100644 RIBsPractice/RIBsPractice/OffGame/OffGameRouter.swift create mode 100644 RIBsPractice/RIBsPractice/OffGame/OffGameViewController.storyboard create mode 100644 RIBsPractice/RIBsPractice/OffGame/OffGameViewController.swift diff --git a/RIBsPractice/RIBsPractice/OffGame/OffGameBuilder.swift b/RIBsPractice/RIBsPractice/OffGame/OffGameBuilder.swift new file mode 100644 index 0000000..6f2b7a0 --- /dev/null +++ b/RIBsPractice/RIBsPractice/OffGame/OffGameBuilder.swift @@ -0,0 +1,34 @@ +// +// OffGameBuilder.swift +// RIBsPractice +// +// Created by Eunyeong Kim on 2020/06/10. +// Copyright © 2020 Eunyeong Kim. All rights reserved. +// + +import RIBs + +protocol OffGameDependency: Dependency {} + +final class OffGameComponent: Component {} + +// MARK: - Builder +protocol OffGameBuildable: Buildable { + func build(withListener listener: OffGameListener) -> OffGameRouting +} + +final class OffGameBuilder: Builder, OffGameBuildable { + + override init(dependency: OffGameDependency) { + super.init(dependency: dependency) + } + + func build(withListener listener: OffGameListener) -> OffGameRouting { + _ = OffGameComponent(dependency: dependency) + let viewController = OffGameViewController() + let interactor = OffGameInteractor(presenter: viewController) + interactor.listener = listener + + return OffGameRouter(interactor: interactor, viewController: viewController) + } +} diff --git a/RIBsPractice/RIBsPractice/OffGame/OffGameInteractor.swift b/RIBsPractice/RIBsPractice/OffGame/OffGameInteractor.swift new file mode 100644 index 0000000..09b1e22 --- /dev/null +++ b/RIBsPractice/RIBsPractice/OffGame/OffGameInteractor.swift @@ -0,0 +1,30 @@ +// +// OffGameInteractor.swift +// RIBsPractice +// +// Created by Eunyeong Kim on 2020/06/10. +// Copyright © 2020 Eunyeong Kim. All rights reserved. +// + +import RIBs +import RxSwift + +protocol OffGameRouting: ViewableRouting {} + +protocol OffGamePresentable: Presentable { + var listener: OffGamePresentableListener? { get set } +} + +protocol OffGameListener: class {} + +final class OffGameInteractor: PresentableInteractor, OffGameInteractable, OffGamePresentableListener { + + weak var router: OffGameRouting? + weak var listener: OffGameListener? + + override init(presenter: OffGamePresentable) { + super.init(presenter: presenter) + + presenter.listener = self + } +} diff --git a/RIBsPractice/RIBsPractice/OffGame/OffGameRouter.swift b/RIBsPractice/RIBsPractice/OffGame/OffGameRouter.swift new file mode 100644 index 0000000..64caab3 --- /dev/null +++ b/RIBsPractice/RIBsPractice/OffGame/OffGameRouter.swift @@ -0,0 +1,25 @@ +// +// OffGameRouter.swift +// RIBsPractice +// +// Created by Eunyeong Kim on 2020/06/10. +// Copyright © 2020 Eunyeong Kim. All rights reserved. +// + +import RIBs + +protocol OffGameInteractable: Interactable { + var router: OffGameRouting? { get set } + var listener: OffGameListener? { get set } +} + +protocol OffGameViewControllable: ViewControllable {} + +final class OffGameRouter: ViewableRouter, OffGameRouting { + + override init(interactor: OffGameInteractable, viewController: OffGameViewControllable) { + super.init(interactor: interactor, viewController: viewController) + + interactor.router = self + } +} diff --git a/RIBsPractice/RIBsPractice/OffGame/OffGameViewController.storyboard b/RIBsPractice/RIBsPractice/OffGame/OffGameViewController.storyboard new file mode 100644 index 0000000..cc00afb --- /dev/null +++ b/RIBsPractice/RIBsPractice/OffGame/OffGameViewController.storyboard @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RIBsPractice/RIBsPractice/OffGame/OffGameViewController.swift b/RIBsPractice/RIBsPractice/OffGame/OffGameViewController.swift new file mode 100644 index 0000000..15708ee --- /dev/null +++ b/RIBsPractice/RIBsPractice/OffGame/OffGameViewController.swift @@ -0,0 +1,18 @@ +// +// OffGameViewController.swift +// RIBsPractice +// +// Created by Eunyeong Kim on 2020/06/10. +// Copyright © 2020 Eunyeong Kim. All rights reserved. +// + +import RIBs +import RxSwift +import UIKit + +protocol OffGamePresentableListener: class {} + +final class OffGameViewController: UIViewController, OffGamePresentable, OffGameViewControllable { + + weak var listener: OffGamePresentableListener? +}