Skip to content

Commit d7f76ee

Browse files
Exposed as a public component
1 parent 3c74833 commit d7f76ee

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
44
# Upcoming
55

66
### 🔄 Changed
7+
- Exposed `SearchResultsView` as a public component
8+
- `isSearching` property in the `ChatChannelListViewModel` is now public
79

810
# [4.28.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.28.0)
911
_February 28, 2023_

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ open class ChatChannelListViewModel: ObservableObject, ChatChannelListController
111111
@Published public var searchResults = [ChannelSelectionInfo]()
112112
@Published var hideTabBar = false
113113

114-
var isSearching: Bool {
114+
public var isSearching: Bool {
115115
!searchText.isEmpty
116116
}
117117

Sources/StreamChatSwiftUI/ChatChannelList/SearchResultsView.swift

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import StreamChat
66
import SwiftUI
77

88
/// View displaying the search results in the channel list.
9-
struct SearchResultsView<Factory: ViewFactory>: View {
9+
public struct SearchResultsView<Factory: ViewFactory>: View {
1010

1111
@Injected(\.colors) private var colors
1212

@@ -19,8 +19,30 @@ struct SearchResultsView<Factory: ViewFactory>: View {
1919
var imageLoader: (ChatChannel) -> UIImage
2020
var onSearchResultTap: (ChannelSelectionInfo) -> Void
2121
var onItemAppear: (Int) -> Void
22+
23+
public init(
24+
factory: Factory,
25+
selectedChannel: Binding<ChannelSelectionInfo?>,
26+
searchResults: [ChannelSelectionInfo],
27+
loadingSearchResults: Bool,
28+
onlineIndicatorShown: @escaping (ChatChannel) -> Bool,
29+
channelNaming: @escaping (ChatChannel) -> String,
30+
imageLoader: @escaping (ChatChannel) -> UIImage,
31+
onSearchResultTap: @escaping (ChannelSelectionInfo) -> Void,
32+
onItemAppear: @escaping (Int) -> Void
33+
) {
34+
self.factory = factory
35+
_selectedChannel = selectedChannel
36+
self.searchResults = searchResults
37+
self.loadingSearchResults = loadingSearchResults
38+
self.onlineIndicatorShown = onlineIndicatorShown
39+
self.channelNaming = channelNaming
40+
self.imageLoader = imageLoader
41+
self.onSearchResultTap = onSearchResultTap
42+
self.onItemAppear = onItemAppear
43+
}
2244

23-
var body: some View {
45+
public var body: some View {
2446
VStack(spacing: 0) {
2547
HStack {
2648
Text(L10n.Message.Search.numberOfResults(searchResults.count))

0 commit comments

Comments
 (0)