You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docusaurus/docs/iOS/swiftui/components/message-list.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,15 +49,16 @@ let messageDisplayOptions = MessageDisplayOptions(
49
49
)
50
50
```
51
51
52
-
For link attachments, you can control the link text attributes (font, font weight, color) based on the message. Here's an example how to change the link color based on the message sender, with the `messageLinkDisplayResolver`:
52
+
For link attachments, you can control the link text attributes (font, font weight, color) based on the message. Here's an example of how to change the link color based on the message sender, with the `messageLinkDisplayResolver`:
53
53
54
54
```swift
55
55
let messageDisplayOptions =MessageDisplayOptions(messageLinkDisplayResolver: { message in
56
56
let color = message.isSentByCurrentUser? UIColor.red: UIColor.green
57
-
return [
58
-
NSAttributedString.Key.foregroundColor: color
59
-
]
60
-
})
57
+
58
+
return [
59
+
NSAttributedString.Key.foregroundColor: color
60
+
]
61
+
})
61
62
let messageListConfig =MessageListConfig(messageDisplayOptions: messageDisplayOptions)
62
63
let utils =Utils(messageListConfig: messageListConfig)
The SDK supports two types of date indicators - floating overlay and date separators inside the messages. This feature can be configured via the `dateIndicatorPlacement` in the `MessageListConfig`. With the floating overlay option (`.overlay`), the date indicator is shown for a short time whenever a new message appears. On the other hand, if you want to always show the date between messages, similarly to Apple Messages and WhatsApp, you should use the `.messageList` option. You can turn off both options by using the `.none` option. Here's an example how to setup the `messageList` option:
70
+
The SDK supports two types of date indicators - floating overlay and date separators in-between the messages. This feature can be configured via the `dateIndicatorPlacement` in the `MessageListConfig`. With the floating overlay option (`.overlay`), the date indicator is shown for a short time whenever a new message appears. On the other hand, if you want to always show the date between messages, similarly to Apple Messages and WhatsApp, you should use the `.messageList` option. You can turn off both options by using the `.none` option. Here's an example of how to set up the `messageList` option:
70
71
71
72
```swift
72
73
let utils =Utils(messageListConfig: MessageListConfig(dateIndicatorPlacement: .messageList))
73
74
let streamChat =StreamChat(chatClient: chatClient, utils: utils)
74
75
```
75
76
76
-
If you want to replace the separating date indicator view, you need to implement the `makeMessageListDateIndicator` method. You can control the size of this view view with the `overlayDateLabelSize` in the `MessageDisplayOptions`.
77
+
If you want to replace the separating date indicator view, you need to implement the `makeMessageListDateIndicator` method. You can control the size of this view with the `overlayDateLabelSize` in the `MessageDisplayOptions`.
0 commit comments