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