SwiftFormat preferKeyPath

This commit is contained in:
Nindi Gill 2023-11-19 19:37:40 +11:00
parent dac5248962
commit c75d1007ee
No known key found for this signature in database
GPG key ID: FF9A7FD590D4F4B1
7 changed files with 11 additions and 11 deletions

View file

@ -16,7 +16,7 @@ class TaskManager: ObservableObject {
var task: Task<Any, Error> = Task {}
var currentState: MistTaskState {
let states: Set<MistTaskState> = Set(taskGroups.flatMap { $0.tasks }.map { $0.state })
let states: Set<MistTaskState> = Set(taskGroups.flatMap(\.tasks).map(\.state))
if states.contains(.inProgress) {
return .inProgress

View file

@ -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 {

View file

@ -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 {

View file

@ -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

View file

@ -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 {

View file

@ -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)

View file

@ -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)