Improved the FeedListViewController view controller in the Feed framework a little bit.

This commit is contained in:
Javier Cicchelli 2024-03-21 00:41:08 +01:00
parent 8c0fed9007
commit 0f4fb372e3

View File

@ -40,11 +40,12 @@ public class FeedListViewController: UITableViewController {
image: UIImage.Icon.star,
children: {
FilterOption.allCases.map { option -> UIAction in
.init(title: option.text,
image: .init(systemName: option.icon)
) { [weak self] _ in
self?.viewModel.filter(by: option)
}
.init(
title: option.text,
image: .init(systemName: option.icon)
) { [weak self] _ in
self?.viewModel.filter(by: option)
}
}
}()
)
@ -90,7 +91,7 @@ public class FeedListViewController: UITableViewController {
_ tableView: UITableView,
cellForRowAt indexPath: IndexPath
) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: FeedItemCell.identifier) else {
guard let cell = FeedItemCell.dequeue(from: tableView) else {
return .init()
}
@ -159,10 +160,8 @@ private extension FeedListViewController {
}
func registerTableCells() {
tableView.register(
FeedItemCell.self,
forCellReuseIdentifier: FeedItemCell.identifier
)
FeedItemCell.register(in: tableView)
TopWordsCell.register(in: tableView)
}
func setNavigationBar() {