Skip to content

Commit 3a5c7d1

Browse files
Updated the docs
1 parent 8c6865e commit 3a5c7d1

File tree

3 files changed

+45
-35
lines changed

3 files changed

+45
-35
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: Chat Channel View
3+
---
4+
5+
## Chat Channel View Overview
6+
7+
The `ChatChannelView` is a container for the view displayed when a channel is presented. The default implementation consists of a header, a message list and a composer.
8+
9+
In order to customize the header, please refer to [this page](../channel-header). For the message list customizations, you can check the [following page](../message-list), while the composer's documentation can be found [here](../message-composer).
10+
11+
## Directly Showing Channel View
12+
13+
In some cases, you want to show directly the channel view, without having a channel list as the previous screen. Here's an example how to show the channel view as an initial screen, with a predefined channel:
14+
15+
```swift
16+
@main
17+
struct TestStreamSDKApp: App {
18+
19+
@Injected(\.chatClient) var chatClient
20+
21+
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
22+
23+
var body: some Scene {
24+
WindowGroup {
25+
ChatChannelView(
26+
viewFactory: DefaultViewFactory.shared,
27+
channelController: controller
28+
)
29+
}
30+
31+
}
32+
33+
private var controller: ChatChannelController {
34+
let controller = chatClient.channelController(
35+
for: try! ChannelId(cid: "messaging:0D991C91-2"),
36+
messageOrdering: .topToBottom
37+
)
38+
39+
return controller
40+
}
41+
42+
}
43+
```

docusaurus/docs/iOS/swiftui/components/message-list.md

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,6 @@ The message list view in the SwiftUI SDK allows several customization options. T
88

99
If you are developing an app with this use-case, you can customize the [message avatars](../custom-avatar), [reactions](../message-reactions), [theming and presentation logic](../../getting-started) and the different types of [attachments](../attachments).
1010

11-
## Directly Showing Channel View
12-
13-
In some cases, you want to show directly the channel view, without having a channel list as the previous screen. Here's an example how to show the channel view as an initial screen, with a predefined channel:
14-
15-
```swift
16-
@main
17-
struct TestStreamSDKApp: App {
18-
19-
@Injected(\.chatClient) var chatClient
20-
21-
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
22-
23-
var body: some Scene {
24-
WindowGroup {
25-
ChatChannelView(
26-
viewFactory: DefaultViewFactory.shared,
27-
channelController: controller
28-
)
29-
}
30-
31-
}
32-
33-
private var controller: ChatChannelController {
34-
let controller = chatClient.channelController(
35-
for: try! ChannelId(cid: "messaging:0D991C91-2"),
36-
messageOrdering: .topToBottom
37-
)
38-
39-
return controller
40-
}
41-
42-
}
43-
```
44-
4511
## Message List Configuration
4612

4713
You can control the display of the helper views around the message (date indicators, avatars) and paddings, via the `MessageListConfig`'s properties `MessageDisplayOptions` and `MessagePaddings`. The `MessageListConfig` is part of the `Utils` class in `StreamChat`. Here's an example on how to hide the date indicators and avatars, while also increasing the horizontal padding.

docusaurus/sidebars-ios.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@
6161
"swiftui/components/query-filters",
6262
"swiftui/components/helper-views",
6363
"swiftui/components/list-tap-events",
64-
"swiftui/components/custom-avatar",
64+
"swiftui/components/chat-channel",
6565
"swiftui/components/channel-header",
6666
"swiftui/components/message-list",
67+
"swiftui/components/custom-avatar",
6768
"swiftui/components/attachments",
6869
"swiftui/components/message-composer",
6970
"swiftui/components/message-reactions",

0 commit comments

Comments
 (0)