Replace uses of forEach with for-in loops.

This commit is contained in:
Brent Simmons
2023-07-09 22:04:38 -07:00
parent 898103ccff
commit 090e63b017
3 changed files with 10 additions and 8 deletions

View File

@@ -749,7 +749,9 @@ extension AppDelegate {
@IBAction func debugDropConditionalGetInfo(_ sender: Any?) {
#if DEBUG
AccountManager.shared.activeAccounts.forEach{ $0.debugDropConditionalGetInfo() }
for account in AccountManager.shared.activeAccounts {
account.debugDropConditionalGetInfo()
}
#endif
}

View File

@@ -370,14 +370,14 @@ private extension SidebarOutlineDataSource {
return false
}
draggedFeeds.forEach { pasteboardFeed in
for pasteboardFeed in draggedFeeds {
guard let sourceAccountID = pasteboardFeed.accountID,
let sourceAccount = AccountManager.shared.existingAccount(with: sourceAccountID),
let feedID = pasteboardFeed.feedID,
let feed = sourceAccount.existingFeed(withFeedID: feedID),
let destinationContainer = parentNode.representedObject as? Container
else {
return
continue
}
var sourceContainer: Container = sourceAccount // default to top level,
@@ -475,14 +475,14 @@ private extension SidebarOutlineDataSource {
return false
}
draggedFolders.forEach { pasteboardFolder in
for pasteboardFolder in draggedFolders {
guard let sourceAccountID = pasteboardFolder.accountID,
let sourceAccount = AccountManager.shared.existingAccount(with: sourceAccountID),
let folderStringID = pasteboardFolder.folderID,
let folderID = Int(folderStringID),
let folder = sourceAccount.existingFolder(withID: folderID)
else {
return
continue
}
if !sameAccount(pasteboardFolder, parentNode) {
copyFolderBetweenAccounts(folder: folder, to: parentNode)

View File

@@ -1139,7 +1139,7 @@ private extension TimelineViewController {
func updateArticleRowMap() {
var rowMap = [String: [Int]]()
var index = 0
articles.forEach { (article) in
for article in articles {
if var indexes = rowMap[article.articleID] {
indexes.append(index)
rowMap[article.articleID] = indexes
@@ -1160,9 +1160,9 @@ private extension TimelineViewController {
func indexesForArticleIDs(_ articleIDs: Set<String>) -> IndexSet {
var indexes = IndexSet()
articleIDs.forEach { (articleID) in
for articleID in articleIDs {
guard let rowsIndex = rows(for: articleID) else {
return
continue
}
for rowIndex in rowsIndex {
indexes.insert(rowIndex)