Replace uses of forEach with for-in loops.

This commit is contained in:
Brent Simmons
2023-07-09 22:20:58 -07:00
parent abb11afe3d
commit d60c2f6b60
7 changed files with 18 additions and 12 deletions

View File

@@ -759,7 +759,7 @@ private extension FeedbinAccountDelegate {
// Feedbin has a tag that we don't have a folder for. We might not get a new
// taggings response for it if it is a folder rename. Force expire the tagging
// so that we will for sure get the new tagging information.
tags.forEach { tag in
for tag in tags {
if !folderNames.contains(tag.name) {
accountMetadata?.conditionalGetInfo[FeedbinAPICaller.ConditionalGetKeys.taggings] = nil
}

View File

@@ -45,7 +45,7 @@ extension NewsBlurAccountDelegate {
// Delete any folders not at NewsBlur
if let folders = account.folders {
folders.forEach { folder in
for folder in folders {
if !folderNames.contains(folder.name ?? "") {
for feed in folder.topLevelFeeds {
account.addFeed(feed)
@@ -66,7 +66,7 @@ extension NewsBlurAccountDelegate {
// Make any folders NewsBlur has, but we don't
// Ignore account-level folder
folderNames.forEach { folderName in
for folderName in folderNames {
if !accountFolderNames.contains(folderName) && folderName != " " {
_ = account.ensureFolder(with: folderName)
}
@@ -100,7 +100,7 @@ extension NewsBlurAccountDelegate {
// Add any feeds we don't have and update any we do
var feedsToAdd = Set<NewsBlurFeed>()
feeds.forEach { newsBlurFeed in
for newsBlurFeed in feeds {
let subFeedID = String(newsBlurFeed.feedID)
if let feed = account.existingFeed(withFeedID: subFeedID) {
@@ -117,7 +117,7 @@ extension NewsBlurAccountDelegate {
}
// Actually add feeds all in one go, so we dont trigger various rebuilding things that Account does.
feedsToAdd.forEach { newsBlurFeed in
for newsBlurFeed in feedsToAdd {
let feed = account.createFeed(with: newsBlurFeed.name, url: newsBlurFeed.feedURL, feedID: String(newsBlurFeed.feedID), homePageURL: newsBlurFeed.homePageURL)
feed.externalID = String(newsBlurFeed.feedID)
account.addFeed(feed)

View File

@@ -228,7 +228,7 @@ private extension TimelineViewController {
}
let menu = NSMenu(title: NSLocalizedString("button.title.share", comment: "Share menu name"))
services.forEach { (service) in
for service in services {
service.delegate = sharingServiceDelegate
let menuItem = NSMenuItem(title: service.menuItemTitle, action: #selector(performShareServiceFromContextualMenu(_:)), keyEquivalent: "")
menuItem.image = service.image

View File

@@ -48,9 +48,9 @@ import Articles
func perform() {
let group = DispatchGroup()
itemSpecifiers.forEach {
for itemSpecifier in itemSpecifiers {
group.enter()
$0.delete() {
itemSpecifier.delete() {
group.leave()
}
}
@@ -63,7 +63,9 @@ import Articles
}
func undo() {
itemSpecifiers.forEach { $0.restore() }
for itemSpecifier in itemSpecifiers {
itemSpecifier.restore()
}
registerRedo()
}

View File

@@ -58,7 +58,9 @@ private extension SendToMarsEditCommand {
func appToUse() -> UserApp? {
marsEditApps.forEach{ $0.updateStatus() }
for app in marsEditApps {
app.updateStatus()
}
for app in marsEditApps {
if app.isRunning {

View File

@@ -75,7 +75,9 @@ final class SmartFeed: PseudoFeed {
if activeAccounts.isEmpty {
updateUnreadCount()
} else {
activeAccounts.forEach { self.fetchUnreadCount(for: $0) }
for account in activeAccounts {
fetchUnreadCount(for: account)
}
}
}

View File

@@ -33,7 +33,7 @@ import RSCore
let faviconHost = URL(string: faviconURLString)?.host else {
return
}
activeAccounts.forEach { account in
for account in activeAccounts {
for feed in Array(account.flattenedFeeds()) {
if let feedURLHost = URL(string: feed.url)?.host {
if faviconHost == feedURLHost {