diff --git a/Projects/Features/BaseFeature/Project.swift b/Projects/Features/BaseFeature/Project.swift index f1d272383..a7d7deba0 100644 --- a/Projects/Features/BaseFeature/Project.swift +++ b/Projects/Features/BaseFeature/Project.swift @@ -19,4 +19,3 @@ let project = Project.module( ) ] ) - diff --git a/Projects/Features/BaseFeature/Sources/BaseReactorViewController.swift b/Projects/Features/BaseFeature/Sources/BaseReactorViewController.swift new file mode 100644 index 000000000..96929c41e --- /dev/null +++ b/Projects/Features/BaseFeature/Sources/BaseReactorViewController.swift @@ -0,0 +1,61 @@ +import NVActivityIndicatorView +import ReactorKit +import RxSwift +import SnapKit +import Then +import UIKit + +open class BaseReactorViewController: UIViewController, View { + public var disposeBag = DisposeBag() + open lazy var indicator = NVActivityIndicatorView(frame: .zero).then { + view.addSubview($0) + $0.snp.makeConstraints { + $0.center.equalToSuperview() + $0.size.equalTo(30) + } + } + + public init(reactor: R) { + super.init(nibName: nil, bundle: nil) + self.reactor = reactor + } + + @available(*, unavailable) + public required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override open func viewDidLoad() { + super.viewDidLoad() + addView() + setLayout() + configureUI() + configureNavigation() + } + + public func bind(reactor: R) { + bindState(reactor: reactor) + bindAction(reactor: reactor) + } + + open func addView() {} + open func setLayout() {} + open func configureUI() { + // 내용 유지? + if #available(iOS 15.0, *) { + let tableViews = self.view.subviews + .compactMap { $0 as? UITableView } + .forEach { + $0.sectionHeaderTopPadding = 0 + } + } + } + + open func configureNavigation() { + // 내용 유지? + self.navigationController?.setNavigationBarHidden(true, animated: false) + } + + open func bindState(reactor: R) {} + open func bindAction(reactor: R) {} +} diff --git a/Projects/Features/BaseFeature/Sources/BaseStoryboardReactorViewController.swift b/Projects/Features/BaseFeature/Sources/BaseStoryboardReactorViewController.swift new file mode 100644 index 000000000..2386d5cc2 --- /dev/null +++ b/Projects/Features/BaseFeature/Sources/BaseStoryboardReactorViewController.swift @@ -0,0 +1,47 @@ +import NVActivityIndicatorView +import ReactorKit +import RxSwift +import SnapKit +import Then +import UIKit +import Utility + +open class BaseStoryboardReactorViewController: UIViewController, StoryboardView, + ViewControllerFromStoryBoard { + public var disposeBag = DisposeBag() + + @available(*, unavailable) + public required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override open func viewDidLoad() { + super.viewDidLoad() + configureUI() + configureNavigation() + } + + public func bind(reactor: R) { + bindState(reactor: reactor) + bindAction(reactor: reactor) + } + + open func configureUI() { + // 내용 유지? + if #available(iOS 15.0, *) { + let tableViews = self.view.subviews + .compactMap { $0 as? UITableView } + .forEach { + $0.sectionHeaderTopPadding = 0 + } + } + } + + open func configureNavigation() { + // 내용 유지? + self.navigationController?.setNavigationBarHidden(true, animated: false) + } + + open func bindState(reactor: R) {} + open func bindAction(reactor: R) {} +}