Files
sing-box-for-apple/ApplicationLibrary/Views/Groups/GroupListView.swift
T
2025-11-26 22:25:48 +08:00

31 lines
864 B
Swift

import Library
import SwiftUI
public struct GroupListView: View {
@EnvironmentObject private var environments: ExtensionEnvironments
@StateObject private var viewModel = GroupListViewModel()
public init() {}
public var body: some View {
VStack {
if viewModel.isLoading {
Text("Loading...")
} else if !viewModel.groups.isEmpty {
ScrollView {
VStack {
ForEach(viewModel.groups, id: \.hashValue) { it in
GroupView(it)
}
}.padding()
}
} else {
Text("Empty groups")
}
}
.onAppear {
viewModel.setCommandClient(environments.commandClient)
viewModel.connect()
}
}
}