From 0611d71bfe3a08489abc57d43fd187610a8f1143 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 9 Jul 2023 22:41:35 -0700 Subject: [PATCH] Replace uses of forEach with for-in loops. --- iOS/AppDelegate.swift | 6 ++++-- iOS/Article/ArticleViewController.swift | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/iOS/AppDelegate.swift b/iOS/AppDelegate.swift index ea511626d..89f26f32d 100644 --- a/iOS/AppDelegate.swift +++ b/iOS/AppDelegate.swift @@ -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) } diff --git a/iOS/Article/ArticleViewController.swift b/iOS/Article/ArticleViewController.swift index 97c7b47b6..f5a0f102e 100644 --- a/iOS/Article/ArticleViewController.swift +++ b/iOS/Article/ArticleViewController.swift @@ -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() + } } }