Skip to content

Commit 943b70a

Browse files
Exposed helper views as public
1 parent 2d0adf6 commit 943b70a

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListConfig.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public struct MessageListConfig {
5757
public struct MessagePaddings {
5858

5959
/// Horizontal padding for messages.
60-
let horizontal: CGFloat
60+
public let horizontal: CGFloat
6161

6262
public init(horizontal: CGFloat = 8) {
6363
self.horizontal = horizontal

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageListHelperViews.swift

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ struct MessageSpacer: View {
120120
}
121121

122122
/// View that's displayed when a message is pinned.
123-
struct MessagePinDetailsView: View {
123+
public struct MessagePinDetailsView: View {
124124

125125
@Injected(\.colors) private var colors
126126
@Injected(\.images) private var images
@@ -129,7 +129,12 @@ struct MessagePinDetailsView: View {
129129
var message: ChatMessage
130130
var reactionsShown: Bool
131131

132-
var body: some View {
132+
public init(message: ChatMessage, reactionsShown: Bool) {
133+
self.message = message
134+
self.reactionsShown = reactionsShown
135+
}
136+
137+
public var body: some View {
133138
HStack {
134139
Image(uiImage: images.pin)
135140
.customizable()
@@ -145,11 +150,15 @@ struct MessagePinDetailsView: View {
145150
}
146151
}
147152

148-
struct TopLeftView<Content: View>: View {
153+
public struct TopLeftView<Content: View>: View {
149154

150155
var content: () -> Content
151156

152-
var body: some View {
157+
public init(content: @escaping () -> Content) {
158+
self.content = content
159+
}
160+
161+
public var body: some View {
153162
VStack {
154163
HStack {
155164
content()

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageRepliesView.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ enum MessageRepliesConstants {
1111
}
1212

1313
/// View shown below a message, when there are replies to it.
14-
struct MessageRepliesView<Factory: ViewFactory>: View {
15-
14+
public struct MessageRepliesView<Factory: ViewFactory>: View {
15+
1616
@Injected(\.fonts) private var fonts
1717
@Injected(\.colors) private var colors
1818

@@ -21,7 +21,14 @@ struct MessageRepliesView<Factory: ViewFactory>: View {
2121
var message: ChatMessage
2222
var replyCount: Int
2323

24-
var body: some View {
24+
public init(factory: Factory, channel: ChatChannel, message: ChatMessage, replyCount: Int) {
25+
self.factory = factory
26+
self.channel = channel
27+
self.message = message
28+
self.replyCount = replyCount
29+
}
30+
31+
public var body: some View {
2532
Button {
2633
// NOTE: this is used to avoid breaking changes.
2734
// Will be updated in a major release.

0 commit comments

Comments
 (0)