Skip to content

Commit 7341ba2

Browse files
committed
Add a modifier that wraps the thread list so that the list can be customized based on state changes
1 parent 6cbfd3e commit 7341ba2

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

Sources/StreamChatSwiftUI/ChatThreadList/ChatThreadListView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public struct ChatThreadListView<Factory: ViewFactory>: View {
8282
viewFactory.makeThreadListBackground(colors: colors)
8383
)
8484
.modifier(viewFactory.makeThreadListHeaderViewModifier(title: title))
85+
.modifier(viewFactory.makeThreadListContainerViewModifier(viewModel: viewModel))
8586
.onAppear {
8687
viewModel.viewDidAppear()
8788
}

Sources/StreamChatSwiftUI/DefaultViewFactory.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,10 @@ extension ViewFactory {
10051005
ChatThreadListLoadingView()
10061006
}
10071007

1008+
public func makeThreadListContainerViewModifier(viewModel: ChatThreadListViewModel) -> some ViewModifier {
1009+
EmptyViewModifier()
1010+
}
1011+
10081012
public func makeThreadListHeaderViewModifier(title: String) -> some ViewModifier {
10091013
ChatThreadListHeaderViewModifier(title: title)
10101014
}

Sources/StreamChatSwiftUI/ViewFactory.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,11 @@ public protocol ViewFactory: AnyObject {
10181018
/// Creates a loading view for the thread list.
10191019
func makeThreadListLoadingView() -> ThreadListLoadingView
10201020

1021+
associatedtype ThreadListContainerModifier: ViewModifier
1022+
/// Creates a modifier that wraps the thread list. It can be used to handle additional state changes.
1023+
/// - Parameter viewModel: The view model that manages the state of the thread list.
1024+
func makeThreadListContainerViewModifier(viewModel: ChatThreadListViewModel) -> ThreadListContainerModifier
1025+
10211026
associatedtype ThreadListHeaderViewModifier: ViewModifier
10221027
/// Creates the thread list navigation header view modifier.
10231028
/// - Parameter title: the title displayed in the header.

0 commit comments

Comments
 (0)