Remove static sharedCoordinator from UIList and ensure a new Coordinator is created for every instance

This commit is contained in:
Benoit Martins 2025-07-23 10:34:38 +02:00
parent 5e267dc2de
commit 927ef5fbbc

View file

@ -100,8 +100,6 @@ class FloatingButton: UIButton {
struct UIList: UIViewRepresentable {
private static var sharedCoordinator: Coordinator?
@StateObject private var viewModel = ChatViewModel()
@StateObject private var paginationState = PaginationState()
@ -346,14 +344,11 @@ struct UIList: UIViewRepresentable {
// MARK: - Coordinator
func makeCoordinator() -> Coordinator {
if UIList.sharedCoordinator == nil {
UIList.sharedCoordinator = Coordinator(
parent: self,
geometryProxy: geometryProxy,
sections: sections
)
}
return UIList.sharedCoordinator!
Coordinator(
parent: self,
geometryProxy: geometryProxy,
sections: sections
)
}
class Coordinator: NSObject, UITableViewDataSource, UITableViewDelegate {