Commit fb14d803 by Dmitriy Stepanets

Added missing file to commit

parent b27b7c66
//
// SettingsDetailsViewController.swift
// 1Weather
//
// Created by Dmitry Stepanets on 27.03.2021.
//
import UIKit
class SettingsDetailsViewController: UIViewController {
//Private
private let viewModel:SettingsDetailsViewModel
private let coordinator:SettingsCoordinator
private let cellFactory:SettingsDetailsCellFactory
private let tableView = UITableView()
init(coordinator: SettingsCoordinator, settingsRow:SettingsRow) {
self.coordinator = coordinator
self.viewModel = SettingsDetailsViewModel(rowType: settingsRow)
self.cellFactory = SettingsDetailsCellFactory(viewModel: self.viewModel)
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
prepareController()
prepareTable()
}
}
//MARK:- Prepare
private extension SettingsDetailsViewController {
func prepareController() {
navigationItem.title = viewModel.rowType.localizedName
}
func prepareTable() {
cellFactory.registerCells(on: tableView)
tableView.separatorStyle = .none
tableView.dataSource = self
tableView.delegate = self
tableView.separatorStyle = .none
tableView.tableFooterView = UIView()
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = UITableView.automaticDimension
view.addSubview(tableView)
}
}
//MARK:- UITableView Data Source
extension SettingsDetailsViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return cellFactory.numberOfRows(inSection: section)
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
return cellFactory.cellFromTableView(tableView: tableView, indexPath: indexPath)
}
}
//MARK:- UITableView Delegate
extension SettingsDetailsViewController: UITableViewDelegate {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment