Add swiftlint & Minor fixes

This commit is contained in:
世界
2025-11-27 16:10:55 +08:00
parent 8855e0eef9
commit 0bfb6d2516
29 changed files with 382 additions and 196 deletions
@@ -4,11 +4,8 @@ import SwiftUI
@MainActor public struct CardManagementSheet: View {
@Environment(\.dismiss) private var dismiss
@StateObject private var configuration = DashboardCardConfiguration()
@Binding private var configurationVersion: Int
public init(configurationVersion: Binding<Int>) {
_configurationVersion = configurationVersion
}
public init() {}
public var body: some View {
#if os(macOS)
@@ -41,7 +38,6 @@ import SwiftUI
Button("Reset", role: .destructive) {
Task {
await configuration.resetToDefault()
configurationVersion += 1
}
}
}
@@ -49,11 +45,9 @@ import SwiftUI
Button("Done") {
dismiss()
}
.keyboardShortcut(.escape, modifiers: [])
}
}
.onExitCommand {
dismiss()
}
}
#else
private var iOSBody: some View {
@@ -74,7 +68,6 @@ import SwiftUI
Button("Reset", role: .destructive) {
Task {
await configuration.resetToDefault()
configurationVersion += 1
}
}
}
@@ -91,13 +84,13 @@ import SwiftUI
isEnabled: configuration.isEnabled(card),
onToggle: {
configuration.toggleCard(card)
configurationVersion += 1
}
)
}
.onMove { source, destination in
configuration.moveCard(from: source, to: destination)
configurationVersion += 1
Task {
await configuration.moveCard(from: source, to: destination)
}
}
}
.applyContentMargins()