1234567891011121314151617181920212223242526272829303132333435363738394041 |
- //
- // ChatListView.swift
- // Chat
- //
- // Created by Sergey Tarasov on 24.07.2022.
- //
- import SwiftUI
- import XMPPFramework
- import XMPPFrameworkSwift
- struct ChatListView: View {
- @StateObject var store: ChatListStore = ChatListStore()
- var body: some View {
- Group {
- if store.users.isEmpty {
- ProgressView()
- } else {
- List(store.users.indices, id: \.self) { index in
- ChatListCellView(
- nickname: store.nicknames[index],
- jid: store.users[index].id
- )
- }
- .listStyle(.plain)
- }
- }
- .onAppear {
- store.fetchChatList()
- }
- }
- }
- struct ChatListView_Previews: PreviewProvider {
- static var previews: some View {
- NavigationView {
- ChatListView()
- }
- }
- }
|