Remove use of forEach.

This commit is contained in:
Brent Simmons
2024-11-18 15:11:18 -08:00
parent c1c4c8b1b6
commit ba0a2d3521
25 changed files with 156 additions and 98 deletions

View File

@@ -452,12 +452,14 @@ class TimelineViewController: UITableViewController, UndoableCommandRunner {
guard let feed = note.userInfo?[UserInfoKey.feed] as? Feed else {
return
}
for indexPath in tableView.indexPathsForVisibleRows? {
guard let article = dataSource.itemIdentifier(for: indexPath) else {
continue
}
if article.feed == feed, let cell = tableView.cellForRow(at: indexPath) as? TimelineTableViewCell, let image = iconImageFor(article) {
cell.setIconImage(image)
if let indexPaths = tableView.indexPathsForVisibleRows {
for indexPath in indexPaths {
guard let article = dataSource.itemIdentifier(for: indexPath) else {
continue
}
if article.feed == feed, let cell = tableView.cellForRow(at: indexPath) as? TimelineTableViewCell, let image = iconImageFor(article) {
cell.setIconImage(image)
}
}
}
}
@@ -466,13 +468,15 @@ class TimelineViewController: UITableViewController, UndoableCommandRunner {
guard coordinator.showIcons, let avatarURL = note.userInfo?[UserInfoKey.url] as? String else {
return
}
for indexPath in tableView.indexPathsForVisibleRows? {
guard let article = dataSource.itemIdentifier(for: indexPath), let authors = article.authors, !authors.isEmpty else {
continue
}
for author in authors {
if author.avatarURL == avatarURL, let cell = tableView.cellForRow(at: indexPath) as? TimelineTableViewCell, let image = iconImageFor(article) {
cell.setIconImage(image)
if let indexPaths = tableView.indexPathsForVisibleRows {
for indexPath in indexPaths {
guard let article = dataSource.itemIdentifier(for: indexPath), let authors = article.authors, !authors.isEmpty else {
continue
}
for author in authors {
if author.avatarURL == avatarURL, let cell = tableView.cellForRow(at: indexPath) as? TimelineTableViewCell, let image = iconImageFor(article) {
cell.setIconImage(image)
}
}
}
}