Skip to content

Commit 8641bb9

Browse files
Updated the docs
1 parent 9151f07 commit 8641bb9

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

Sources/StreamChatSwiftUI/ChatChannel/ChatChannelViewModel.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
3939

4040
private var loadingPreviousMessages: Bool = false
4141
private var lastMessageRead: String?
42-
private var messageChanges = [ListChange<ChatMessage>]()
4342

4443
public var channelController: ChatChannelController
4544
public var messageController: ChatMessageController?

docusaurus/docs/iOS/swiftui/components/custom-avatar.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,29 @@ title: Message Avatar View
44

55
## Injecting Custom Avatar View
66

7-
The default avatar shown for the message sender in the SDK is a rounded image with the user's photo. You can change the look and feel of this component, as well as introduce additional elements, such as the sender name.
7+
The default avatar shown for the message sender in the SDK is a rounded image with the user's photo. You can change the look and feel of this component, as well as introduce additional elements.
88

9-
To do this, you need to implement the `makeMessageAvatarView` of the `ViewFactory` and return your custom view. Here's an example on how to create a custom avatar with the author's name bellow the image.
9+
To do this, you need to implement the `makeMessageAvatarView` of the `ViewFactory` and return your custom view. Here's an example on how to create a custom avatar with rounded rectangle clip shape.
1010

1111
```swift
1212
import StreamChat
1313
import NukeUI
1414
import Nuke
1515

1616
struct CustomUserAvatar: View {
17-
var author: ChatUser
17+
var avatarURL: URL?
1818

1919
public var body: some View {
20-
VStack {
21-
if let url = author.imageURL?.absoluteString {
20+
ZStack {
21+
if let url = avatarURL {
2222
LazyImage(source: url)
23-
.clipShape(Circle())
23+
.clipShape(RoundedRectangle(cornerRadius: 8))
2424
.frame(width: 40, height: 40)
2525
} else {
2626
Image(systemName: "person.circle")
2727
.resizable()
2828
.frame(width: 40, height: 40)
2929
}
30-
Text(author.name ?? "")
31-
.font(.system(size: 13))
32-
.frame(maxWidth: 60)
3330
}
3431
}
3532

@@ -45,8 +42,8 @@ class CustomFactory: ViewFactory {
4542

4643
init() {}
4744

48-
func makeMessageAvatarView(for user: ChatUser) -> some View {
49-
CustomUserAvatar(author: user)
45+
func makeMessageAvatarView(for avatarURL: URL?) -> some View {
46+
CustomUserAvatar(avatarURL: avatarURL)
5047
}
5148

5249
}

0 commit comments

Comments
 (0)