Skip to content

Commit 16939dc

Browse files
Few channel list item components made public
1 parent c581a0e commit 16939dc

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListHelperViews.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,20 @@ struct MessageDateView: View {
7474
}
7575

7676
/// View that displays the read indicator for a message.
77-
struct MessageReadIndicatorView: View {
77+
public struct MessageReadIndicatorView: View {
7878
@Injected(\.images) private var images
7979
@Injected(\.fonts) private var fonts
8080
@Injected(\.colors) private var colors
8181

8282
var readUsers: [ChatUser]
8383
var showReadCount: Bool
8484

85-
var body: some View {
85+
public init(readUsers: [ChatUser], showReadCount: Bool) {
86+
self.readUsers = readUsers
87+
self.showReadCount = showReadCount
88+
}
89+
90+
public var body: some View {
8691
HStack(spacing: 2) {
8792
if showReadCount && !readUsers.isEmpty {
8893
Text("\(readUsers.count)")

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelHelperViews.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ public struct SubtitleText: View {
1111

1212
var text: String
1313

14+
public init(text: String) {
15+
self.text = text
16+
}
17+
1418
public var body: some View {
1519
Text(text)
1620
.lineLimit(1)
@@ -56,14 +60,18 @@ public struct AvatarView: View {
5660
}
5761
}
5862

59-
struct ChatTitleView: View {
63+
public struct ChatTitleView: View {
6064

6165
@Injected(\.fonts) private var fonts
6266
@Injected(\.colors) private var colors
6367

6468
var name: String
6569

66-
var body: some View {
70+
public init(name: String) {
71+
self.name = name
72+
}
73+
74+
public var body: some View {
6775
Text(name)
6876
.lineLimit(1)
6977
.font(fonts.bodyBold)

Sources/StreamChatSwiftUI/CommonViews/TypingIndicatorView.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
import SwiftUI
66

77
/// View shown when other users are typing.
8-
struct TypingIndicatorView: View {
8+
public struct TypingIndicatorView: View {
99

1010
@State private var isTyping = false
1111

1212
private let animationDuration: CGFloat = 0.75
1313

14-
var body: some View {
14+
public init() { /* Public init */ }
15+
16+
public var body: some View {
1517
HStack(spacing: 4) {
1618
TypingIndicatorCircle(isTyping: isTyping)
1719
.animation(

0 commit comments

Comments
 (0)