diff --git a/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift b/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift index 9f01c59ff..025382447 100644 --- a/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift +++ b/Account/Sources/Account/Feedbin/FeedbinAccountDelegate.swift @@ -777,7 +777,7 @@ private extension FeedbinAccountDelegate { // Delete any folders not at Feedbin if let folders = account.folders { - folders.forEach { folder in + for folder in folders { if !tagNames.contains(folder.name ?? "") { for feed in folder.topLevelFeeds { account.addFeed(feed) @@ -797,7 +797,7 @@ private extension FeedbinAccountDelegate { }() // Make any folders Feedbin has, but we don't - tagNames.forEach { tagName in + for tagName in tagNames { if !folderNames.contains(tagName) { _ = account.ensureFolder(with: tagName) } @@ -811,29 +811,29 @@ private extension FeedbinAccountDelegate { assert(Thread.isMainThread) logger.debug("Syncing feeds with \(subscriptions.count, privacy: .public) subscriptions.") - - let subFeedIds = subscriptions.map { String($0.feedID) } - - // Remove any feeds that are no longer in the subscriptions - if let folders = account.folders { - for folder in folders { - for feed in folder.topLevelFeeds { - if !subFeedIds.contains(feed.feedID) { - folder.removeFeed(feed) - } - } - } - } - - for feed in account.topLevelFeeds { - if !subFeedIds.contains(feed.feedID) { - account.removeFeed(feed) - } - } - - // Add any feeds we don't have and update any we do - var subscriptionsToAdd = Set() - subscriptions.forEach { subscription in + + let subFeedIds = subscriptions.map { String($0.feedID) } + + // Remove any feeds that are no longer in the subscriptions + if let folders = account.folders { + for folder in folders { + for feed in folder.topLevelFeeds { + if !subFeedIds.contains(feed.feedID) { + folder.removeFeed(feed) + } + } + } + } + + for feed in account.topLevelFeeds { + if !subFeedIds.contains(feed.feedID) { + account.removeFeed(feed) + } + } + + // Add any feeds we don't have and update any we do + var subscriptionsToAdd = Set() + for subscription in subscriptions { let subFeedId = String(subscription.feedID) @@ -852,7 +852,7 @@ private extension FeedbinAccountDelegate { } // Actually add subscriptions all in one go, so we don’t trigger various rebuilding things that Account does. - subscriptionsToAdd.forEach { subscription in + for subscription in subscriptionsToAdd { let feed = account.createFeed(with: subscription.name, url: subscription.url, feedID: String(subscription.feedID), homePageURL: subscription.homePageURL) feed.externalID = String(subscription.subscriptionID) account.addFeed(feed) diff --git a/Mac/MainWindow/AddFeed/FolderTreeMenu.swift b/Mac/MainWindow/AddFeed/FolderTreeMenu.swift index 1c696f0dc..d2ca844ff 100644 --- a/Mac/MainWindow/AddFeed/FolderTreeMenu.swift +++ b/Mac/MainWindow/AddFeed/FolderTreeMenu.swift @@ -62,7 +62,7 @@ import Account private static func addFolderItemsToMenuWithNodes(menu: NSMenu, nodes: [Node], indentationLevel: Int) { - nodes.forEach { (oneNode) in + for oneNode in nodes { if let nameProvider = oneNode.representedObject as? DisplayNameProvider { diff --git a/Shared/Timeline/FetchRequestQueue.swift b/Shared/Timeline/FetchRequestQueue.swift index a895ddf6f..0e617c9ad 100644 --- a/Shared/Timeline/FetchRequestQueue.swift +++ b/Shared/Timeline/FetchRequestQueue.swift @@ -24,7 +24,9 @@ import Foundation func cancelAllRequests() { precondition(Thread.isMainThread) - pendingRequests.forEach { $0.isCanceled = true } + for pendingRequest in pendingRequests { + pendingRequest.isCanceled = true + } currentRequest?.isCanceled = true pendingRequests = [FetchRequestOperation]() } diff --git a/iOS/MasterFeed/MasterFeedViewController.swift b/iOS/MasterFeed/MasterFeedViewController.swift index 33ee05450..f1af15f3e 100644 --- a/iOS/MasterFeed/MasterFeedViewController.swift +++ b/iOS/MasterFeed/MasterFeedViewController.swift @@ -879,9 +879,9 @@ private extension MasterFeedViewController { } func applyToAvailableCells(_ completion: (MasterFeedTableViewCell, IndexPath) -> Void) { - tableView.visibleCells.forEach { cell in + for cell in tableView.visibleCells { guard let indexPath = tableView.indexPath(for: cell) else { - return + continue } completion(cell as! MasterFeedTableViewCell, indexPath) } diff --git a/iOS/MasterTimeline/MasterTimelineViewController.swift b/iOS/MasterTimeline/MasterTimelineViewController.swift index 62ef15bff..6c51fe212 100644 --- a/iOS/MasterTimeline/MasterTimelineViewController.swift +++ b/iOS/MasterTimeline/MasterTimelineViewController.swift @@ -476,9 +476,12 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner guard let feed = note.userInfo?[UserInfoKey.feed] as? Feed else { return } - tableView.indexPathsForVisibleRows?.forEach { indexPath in + guard let indexPathsForVisibleRows = tableView.indexPathsForVisibleRows else { + return + } + for indexPath in indexPathsForVisibleRows { guard let article = dataSource.itemIdentifier(for: indexPath) else { - return + continue } if article.feed == feed, let cell = tableView.cellForRow(at: indexPath) as? MasterTimelineTableViewCell, let image = iconImageFor(article) { cell.setIconImage(image) @@ -490,9 +493,12 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner guard coordinator.showIcons, let avatarURL = note.userInfo?[UserInfoKey.url] as? String else { return } - tableView.indexPathsForVisibleRows?.forEach { indexPath in + guard let indexPathsForVisibleRows = tableView.indexPathsForVisibleRows else { + return + } + for indexPath in indexPathsForVisibleRows { guard let article = dataSource.itemIdentifier(for: indexPath), let authors = article.authors, !authors.isEmpty else { - return + continue } for author in authors { if author.avatarURL == avatarURL, let cell = tableView.cellForRow(at: indexPath) as? MasterTimelineTableViewCell, let image = iconImageFor(article) { diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 5d5cd80d1..362a09d1f 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -1468,7 +1468,7 @@ private extension SceneCoordinator { func rebuildArticleDictionaries() { var idDictionary = [String: Article]() - articles.forEach { article in + for article in articles { idDictionary[article.articleID] = article }