Skip to content

Commit

Permalink
Configure the reusable cell in TimelineViewController.
Browse files Browse the repository at this point in the history
  • Loading branch information
brentsimmons committed Feb 3, 2025
1 parent 08c0de1 commit 00bdf3e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion iOS/MainWindow/Timeline/TimelineViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ final class TimelineViewController: UITableViewController, UndoableCommandRunner
private lazy var refreshProgressItemButton = UIBarButtonItem(customView: refreshProgressView)
private lazy var refreshProgressView: RefreshProgressView = Bundle.main.loadNibNamed("RefreshProgressView", owner: self, options: nil)?[0] as! RefreshProgressView

private static let cellReuseIdentifier = "timelineCell"

private lazy var dataSource = makeDataSource()
private let searchController = UISearchController(searchResultsController: nil)

Expand Down Expand Up @@ -110,6 +112,7 @@ final class TimelineViewController: UITableViewController, UndoableCommandRunner
definesPresentationContext = true

// Configure the table
tableView.register(MainTimelineTableViewCell.self, forCellReuseIdentifier: Self.cellReuseIdentifier)
tableView.dataSource = dataSource
tableView.isPrefetchingEnabled = false

Expand Down Expand Up @@ -767,7 +770,7 @@ private extension TimelineViewController {
func makeDataSource() -> UITableViewDiffableDataSource<Int, Article> {
let dataSource: UITableViewDiffableDataSource<Int, Article> =
MainTimelineDataSource(tableView: tableView, cellProvider: { [weak self] tableView, indexPath, article in
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! MainTimelineTableViewCell
let cell = tableView.dequeueReusableCell(withIdentifier: Self.cellReuseIdentifier, for: indexPath) as! MainTimelineTableViewCell
self?.configure(cell, article: article)
return cell
})
Expand Down

0 comments on commit 00bdf3e

Please sign in to comment.