import SwiftUI
struct Members: View {
@ObservedObject var memberData = MemberData()
var body: some View {
NavigationView {
List {
// 1. Members
ForEach(memberData.members) { member in
MembersListCell(member: member)
}
// 2. Activity Indicator. Last element of list.
// Show activity spinner if backend has more data.
// Its onAppear method is used to load new members. Pagination done.
if memberData.membersListFull == false {
ActivityIndicator()
.onAppear {
memberData.fetchMembers()
}
}
}
.navigationBarTitle("Members")
}
}
}
2
import Foundation
import Combine
class MemberData: ObservableObject {