code review notes
This commit is contained in:
parent
667c15aa33
commit
0b5b6e8358
|
|
@ -25,20 +25,8 @@ import UIKit
|
|||
/// Base collection controller configurable with view model and CollectionViewWrapperView as custom view.
|
||||
open class BaseCollectionContentController<ViewModel>: BaseScrollContentController<ViewModel, CollectionViewWrapperView> {
|
||||
|
||||
/// Initializer with view model, collection view holder and table director parameters.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - viewModel: A view model to configure this controller.
|
||||
/// - collectionViewHolder: A view that contains collection view.
|
||||
public init(viewModel: ViewModel,
|
||||
collectionViewHolder: CollectionViewWrapperView = .init(layout: UICollectionViewFlowLayout())) {
|
||||
|
||||
super.init(viewModel: viewModel,
|
||||
customView: collectionViewHolder)
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
override open func createView() -> CollectionViewWrapperView {
|
||||
return CollectionViewWrapperView(layout: UICollectionViewFlowLayout())
|
||||
}
|
||||
|
||||
/// Contained UICollectionView instance.
|
||||
|
|
|
|||
|
|
@ -26,16 +26,14 @@ import UIKit.UIView
|
|||
open class BaseCustomViewController<ViewModel, View: UIView>: BaseConfigurableController<ViewModel> {
|
||||
|
||||
/// Contained custom view.
|
||||
public let customView: View
|
||||
public private(set) lazy var customView = createView()
|
||||
|
||||
/// Initializer with view model and custom view parameters.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - viewModel: A view model to configure this controller.
|
||||
/// - customView: UIView instance to assign in view property.
|
||||
public init(viewModel: ViewModel, customView: View) {
|
||||
self.customView = customView
|
||||
|
||||
public override init(viewModel: ViewModel) {
|
||||
super.init(viewModel: viewModel)
|
||||
}
|
||||
|
||||
|
|
@ -47,4 +45,11 @@ open class BaseCustomViewController<ViewModel, View: UIView>: BaseConfigurableCo
|
|||
view = customView
|
||||
}
|
||||
|
||||
/// Creates custom view.
|
||||
///
|
||||
/// - Returns: Initialized custom view.
|
||||
open func createView() -> View {
|
||||
return View()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,26 +26,17 @@ import TableKit
|
|||
open class BaseTableContentController<ViewModel>: BaseScrollContentController<ViewModel, TableViewWrapperView> {
|
||||
|
||||
/// TableDirector binded to table view.
|
||||
public let tableDirector: TableDirector
|
||||
public private(set) lazy var tableDirector = createTableDirector()
|
||||
|
||||
/// Initializer with view model, table view holder and table director parameters.
|
||||
/// Creates tableDirector for table view.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - viewModel: A view model to configure this controller.
|
||||
/// - tableViewHolder: A view that contains table view.
|
||||
/// - tableDirector: Custom TableDirector instance or nil to use the default one.
|
||||
public init(viewModel: ViewModel,
|
||||
tableViewHolder: TableViewWrapperView = .init(tableViewStyle: .plain),
|
||||
tableDirector: TableDirector? = nil) {
|
||||
|
||||
self.tableDirector = tableDirector ?? TableDirector(tableView: tableViewHolder.tableView)
|
||||
|
||||
super.init(viewModel: viewModel,
|
||||
customView: tableViewHolder)
|
||||
/// - Returns: Initialized TableDirector.
|
||||
open func createTableDirector() -> TableDirector {
|
||||
return TableDirector(tableView: tableView)
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
override open func createView() -> TableViewWrapperView {
|
||||
return TableViewWrapperView(tableViewStyle: .plain)
|
||||
}
|
||||
|
||||
override open func configureAppearance() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue