Replace uses of forEach with for-in loops.

This commit is contained in:
Brent Simmons
2023-07-09 22:41:35 -07:00
parent 0be38b4eb3
commit 0611d71bfe
2 changed files with 9 additions and 4 deletions

View File

@@ -154,9 +154,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
// MARK: - API
@MainActor func manualRefresh(errorHandler: @escaping (Error) -> ()) {
UIApplication.shared.connectedScenes.compactMap( { $0.delegate as? SceneDelegate } ).forEach {
$0.cleanUp(conditional: true)
let sceneDelegates = UIApplication.shared.connectedScenes.compactMap{ $0.delegate as? SceneDelegate }
for sceneDelegate in sceneDelegates {
sceneDelegate.cleanUp(conditional: true)
}
AccountManager.shared.refreshAll(errorHandler: errorHandler)
}

View File

@@ -576,8 +576,11 @@ extension ArticleViewController: UIPageViewControllerDelegate {
coordinator.selectArticle(article, animations: [.select, .scroll, .navigation])
articleExtractorButton.buttonState = currentWebViewController?.articleExtractorButtonState ?? .off
previousViewControllers.compactMap({ $0 as? WebViewController }).forEach({ $0.stopWebViewActivity() })
let webViewControllers = previousViewControllers.compactMap{ $0 as? WebViewController }
for webViewController in webViewControllers {
webViewController.stopWebViewActivity()
}
}
}