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
@@ -1,4 +1,3 @@
import Combine
import Libbox
import Library
import SwiftUI
@@ -8,21 +7,8 @@ public class GroupListViewModel: ObservableObject {
@Published public var isLoading = true
@Published public var groups: [OutboundGroup] = []
private var commandClient: CommandClient?
private var cancellables = Set<AnyCancellable>()
public init() {}
public func setCommandClient(_ client: CommandClient) {
commandClient = client
client.$groups
.compactMap { $0 }
.sink { [weak self] goGroups in
self?.setGroups(goGroups)
}
.store(in: &cancellables)
}
public func connect() {
if ApplicationLibrary.inPreview {
groups = [
@@ -40,7 +26,8 @@ public class GroupListViewModel: ObservableObject {
}
}
private func setGroups(_ goGroups: [LibboxOutboundGroup]) {
public func setGroups(_ goGroups: [LibboxOutboundGroup]?) {
guard let goGroups else { return }
var groups = [OutboundGroup]()
for goGroup in goGroups {
var items = [OutboundGroupItem]()