From c75d1007eecf040d69716ac407e9d6a527be39d9 Mon Sep 17 00:00:00 2001 From: Nindi Gill Date: Sun, 19 Nov 2023 19:37:40 +1100 Subject: [PATCH] SwiftFormat preferKeyPath --- Mist/Helpers/TaskManager.swift | 2 +- Mist/Model/Installer.swift | 4 ++-- Mist/Views/Activity/ActivityView.swift | 2 +- Mist/Views/ContentView.swift | 4 ++-- Mist/Views/FooterView.swift | 4 ++-- Mist/Views/Refresh/RefreshView.swift | 4 ++-- Mist/Views/Settings/SettingsInstallersView.swift | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Mist/Helpers/TaskManager.swift b/Mist/Helpers/TaskManager.swift index c6a9471..48b8304 100644 --- a/Mist/Helpers/TaskManager.swift +++ b/Mist/Helpers/TaskManager.swift @@ -16,7 +16,7 @@ class TaskManager: ObservableObject { var task: Task = Task {} var currentState: MistTaskState { - let states: Set = Set(taskGroups.flatMap { $0.tasks }.map { $0.state }) + let states: Set = Set(taskGroups.flatMap(\.tasks).map(\.state)) if states.contains(.inProgress) { return .inProgress diff --git a/Mist/Model/Installer.swift b/Mist/Model/Installer.swift index c933914..a90afd9 100644 --- a/Mist/Model/Installer.swift +++ b/Mist/Model/Installer.swift @@ -750,7 +750,7 @@ struct Installer: Decodable, Hashable, Identifiable { "date": date, "compatible": compatible, "distribution": distributionURL, - "packages": packages.map { $0.dictionary }, + "packages": packages.map(\.dictionary), "beta": beta ] } @@ -780,7 +780,7 @@ struct Installer: Decodable, Hashable, Identifiable { } var size: UInt64 { - UInt64(packages.map { $0.size }.reduce(0, +)) + UInt64(packages.map(\.size).reduce(0, +)) } var diskImageSize: Double { diff --git a/Mist/Views/Activity/ActivityView.swift b/Mist/Views/Activity/ActivityView.swift index 376706b..bd2cfaf 100644 --- a/Mist/Views/Activity/ActivityView.swift +++ b/Mist/Views/Activity/ActivityView.swift @@ -36,7 +36,7 @@ struct ActivityView: View { private let width: CGFloat = 420 private let height: CGFloat = 640 private var bootableInstaller: Bool { - taskManager.taskGroups.map { $0.section }.contains(.bootableInstaller) + taskManager.taskGroups.map(\.section).contains(.bootableInstaller) } private var venturaOrOlder: Bool { diff --git a/Mist/Views/ContentView.swift b/Mist/Views/ContentView.swift index 0e74188..34be189 100644 --- a/Mist/Views/ContentView.swift +++ b/Mist/Views/ContentView.swift @@ -40,7 +40,7 @@ struct ContentView: View { } if showCompatible { - filteredFirmwares = filteredFirmwares.filter { $0.compatible } + filteredFirmwares = filteredFirmwares.filter(\.compatible) } return filteredFirmwares @@ -64,7 +64,7 @@ struct ContentView: View { } if showCompatible { - filteredInstallers = filteredInstallers.filter { $0.compatible } + filteredInstallers = filteredInstallers.filter(\.compatible) } return filteredInstallers diff --git a/Mist/Views/FooterView.swift b/Mist/Views/FooterView.swift index a877755..c09c4bb 100644 --- a/Mist/Views/FooterView.swift +++ b/Mist/Views/FooterView.swift @@ -56,9 +56,9 @@ struct FooterView: View { switch downloadType { case .firmware: - dictionaries = firmwares.map { $0.dictionary } + dictionaries = firmwares.map(\.dictionary) case .installer: - dictionaries = installers.map { $0.dictionary } + dictionaries = installers.map(\.dictionary) } do { diff --git a/Mist/Views/Refresh/RefreshView.swift b/Mist/Views/Refresh/RefreshView.swift index faca53b..885484e 100644 --- a/Mist/Views/Refresh/RefreshView.swift +++ b/Mist/Views/Refresh/RefreshView.swift @@ -172,7 +172,7 @@ struct RefreshView: View { continue } - installers.append(contentsOf: getInstallers(from: productsDictionary).filter { !installers.map { $0.id }.contains($0.id) }) + installers.append(contentsOf: getInstallers(from: productsDictionary).filter { !installers.map(\.id).contains($0.id) }) } catch { continue } @@ -200,7 +200,7 @@ struct RefreshView: View { if let array: [[String: Any]] = UserDefaults.standard.array(forKey: "catalogs") as? [[String: Any]] { do { catalogs = try JSONDecoder().decode([Catalog].self, from: JSONSerialization.data(withJSONObject: array)) - let catalogTypes: [CatalogType] = catalogs.map { $0.type } + let catalogTypes: [CatalogType] = catalogs.map(\.type) for catalogType in CatalogType.allCases where !catalogTypes.contains(catalogType) { let catalog: Catalog = .init(type: catalogType, standard: true, customerSeed: false, developerSeed: false, publicSeed: false) diff --git a/Mist/Views/Settings/SettingsInstallersView.swift b/Mist/Views/Settings/SettingsInstallersView.swift index bce9d1e..1ae6e25 100644 --- a/Mist/Views/Settings/SettingsInstallersView.swift +++ b/Mist/Views/Settings/SettingsInstallersView.swift @@ -48,7 +48,7 @@ struct SettingsInstallersView: View { do { var catalogs: [Catalog] = try JSONDecoder().decode([Catalog].self, from: JSONSerialization.data(withJSONObject: array)) - let catalogTypes: [CatalogType] = catalogs.map { $0.type } + let catalogTypes: [CatalogType] = catalogs.map(\.type) for catalogType in CatalogType.allCases where !catalogTypes.contains(catalogType) { let catalog: Catalog = .init(type: catalogType, standard: true, customerSeed: false, developerSeed: false, publicSeed: false)