diff --git a/Frameworks/Feed/Bundle/Sources/Logic/View Models/FeedListViewModel.swift b/Frameworks/Feed/Bundle/Sources/Logic/View Models/FeedListViewModel.swift index 96ef07a..08671b7 100644 --- a/Frameworks/Feed/Bundle/Sources/Logic/View Models/FeedListViewModel.swift +++ b/Frameworks/Feed/Bundle/Sources/Logic/View Models/FeedListViewModel.swift @@ -117,6 +117,12 @@ extension FeedListViewController { ? items[index - 1] : items[index] } + + func openItem(at index: Int) { + guard let item = item(for: index) else { return } + + coordination?.open(item) + } } } diff --git a/Frameworks/Feed/Bundle/Sources/UI/View Controllers/FeedListViewController.swift b/Frameworks/Feed/Bundle/Sources/UI/View Controllers/FeedListViewController.swift index adbc9dc..4fee1d3 100644 --- a/Frameworks/Feed/Bundle/Sources/UI/View Controllers/FeedListViewController.swift +++ b/Frameworks/Feed/Bundle/Sources/UI/View Controllers/FeedListViewController.swift @@ -13,7 +13,7 @@ import ReviewsUIKit import SwiftUI import UIKit -class FeedListViewController: UITableViewController { +final class FeedListViewController: UITableViewController { // MARK: Constants private let viewModel: ViewModel @@ -131,17 +131,12 @@ class FeedListViewController: UITableViewController { _ tableView: UITableView, didSelectRowAt indexPath: IndexPath ) { - guard let item = viewModel.item(for: indexPath.row) else { return } - + viewModel.openItem(at: indexPath.row) + tableView.deselectRow( at: indexPath, animated: true ) - - navigationController?.pushViewController( - FeedItemViewController(item), - animated: true - ) } }