Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
190 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// LoggedInBuilder.swift | ||
// TodoList | ||
// | ||
// Created by 김종권 on 2021/04/29. | ||
// | ||
|
||
import RIBs | ||
|
||
protocol LoggedInDependency: Dependency { | ||
// TODO: Make sure to convert the variable into lower-camelcase. | ||
var LoggedInViewController: LoggedInViewControllable { get } | ||
// TODO: Declare the set of dependencies required by this RIB, but won't be | ||
// created by this RIB. | ||
} | ||
|
||
final class LoggedInComponent: Component<LoggedInDependency> { | ||
|
||
// TODO: Make sure to convert the variable into lower-camelcase. | ||
fileprivate var LoggedInViewController: LoggedInViewControllable { | ||
return dependency.LoggedInViewController | ||
} | ||
|
||
// TODO: Declare 'fileprivate' dependencies that are only used by this RIB. | ||
} | ||
|
||
// MARK: - Builder | ||
|
||
protocol LoggedInBuildable: Buildable { | ||
func build(withListener listener: LoggedInListener) -> LoggedInRouting | ||
} | ||
|
||
final class LoggedInBuilder: Builder<LoggedInDependency>, LoggedInBuildable { | ||
|
||
override init(dependency: LoggedInDependency) { | ||
super.init(dependency: dependency) | ||
} | ||
|
||
func build(withListener listener: LoggedInListener) -> LoggedInRouting { | ||
let component = LoggedInComponent(dependency: dependency) | ||
let interactor = LoggedInInteractor() | ||
interactor.listener = listener | ||
return LoggedInRouter(interactor: interactor, viewController: component.LoggedInViewController) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// LoggedInInteractor.swift | ||
// TodoList | ||
// | ||
// Created by 김종권 on 2021/04/29. | ||
// | ||
|
||
import RIBs | ||
import RxSwift | ||
|
||
protocol LoggedInRouting: Routing { | ||
func cleanupViews() | ||
// TODO: Declare methods the interactor can invoke to manage sub-tree via the router. | ||
} | ||
|
||
protocol LoggedInListener: class { | ||
// TODO: Declare methods the interactor can invoke to communicate with other RIBs. | ||
} | ||
|
||
final class LoggedInInteractor: Interactor, LoggedInInteractable { | ||
|
||
weak var router: LoggedInRouting? | ||
weak var listener: LoggedInListener? | ||
|
||
// TODO: Add additional dependencies to constructor. Do not perform any logic | ||
// in constructor. | ||
override init() {} | ||
|
||
override func didBecomeActive() { | ||
super.didBecomeActive() | ||
// TODO: Implement business logic here. | ||
} | ||
|
||
override func willResignActive() { | ||
super.willResignActive() | ||
|
||
router?.cleanupViews() | ||
// TODO: Pause any business logic. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// LoggedInRouter.swift | ||
// TodoList | ||
// | ||
// Created by 김종권 on 2021/04/29. | ||
// | ||
|
||
import RIBs | ||
|
||
protocol LoggedInInteractable: Interactable { | ||
var router: LoggedInRouting? { get set } | ||
var listener: LoggedInListener? { get set } | ||
} | ||
|
||
protocol LoggedInViewControllable: ViewControllable { | ||
// TODO: Declare methods the router invokes to manipulate the view hierarchy. Since | ||
// this RIB does not own its own view, this protocol is conformed to by one of this | ||
// RIB's ancestor RIBs' view. | ||
} | ||
|
||
final class LoggedInRouter: Router<LoggedInInteractable>, LoggedInRouting { | ||
|
||
// TODO: Constructor inject child builder protocols to allow building children. | ||
init(interactor: LoggedInInteractable, viewController: LoggedInViewControllable) { | ||
self.viewController = viewController | ||
super.init(interactor: interactor) | ||
interactor.router = self | ||
} | ||
|
||
func cleanupViews() { | ||
// TODO: Since this router does not own its view, it needs to cleanup the views | ||
// it may have added to the view hierarchy, when its interactor is deactivated. | ||
} | ||
|
||
// MARK: - Private | ||
|
||
private let viewController: LoggedInViewControllable | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// | ||
// RootComponent+LoggedIn.swift | ||
// TodoList | ||
// | ||
// Created by 김종권 on 2021/04/29. | ||
// | ||
|
||
import RIBs | ||
|
||
/// The dependencies needed from the parent scope of Root to provide for the LoggedIn scope. | ||
// TODO: Update RootDependency protocol to inherit this protocol. | ||
protocol RootDependencyLoggedIn: Dependency { | ||
// TODO: Declare dependencies needed from the parent scope of Root to provide dependencies | ||
// for the LoggedIn scope. | ||
} | ||
|
||
extension RootComponent: LoggedInDependency { | ||
var LoggedInViewController: LoggedInViewControllable { | ||
return rootViewController | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters