Currently you should be not able to build with directly write ChannelDestination when you use your own ViewFactory extended CustomFactory

You need to do few steps for making the function to be exact same with ViewFactory to override it.
- Add Custom Channel Destination to file
struct CustomChannelDestination: View {
var channel: ChatChannel
var body: some View {
VStack {
Text("This is the channel \(channel.name ?? "")")
}
}
}
- Call makeChannelDestination to create ChannelDestination View
func makeChannelDestination() -> (ChannelSelectionInfo) -> CustomChannelDestination {
{ selectionInfo in
CustomChannelDestination(channel: selectionInfo.channel)
}
}
- Finally update channel destination in makeChannelListItem
public func makeChannelListItem(
channel: ChatChannel,
channelName: String,
avatar: UIImage,
onlineIndicatorShown: Bool,
disabled: Bool,
selectedChannel: Binding<ChannelSelectionInfo?>,
swipedChannelId: Binding<String?>,
channelDestination: @escaping (ChannelSelectionInfo) -> CustomChannelDestination,
onItemTap: @escaping (ChatChannel) -> Void,
trailingSwipeRightButtonTapped: @escaping (ChatChannel) -> Void,
trailingSwipeLeftButtonTapped: @escaping (ChatChannel) -> Void,
leadingSwipeButtonTapped: @escaping (ChatChannel) -> Void
) -> some View {
[YOUR CUSTOM VIEW]
}
The main point here is to init ViewFactory ChannelDestination.
Whole Code:
> class ChatCustomUIFactory: ViewFactory {
>
> @Injected(\.chatClient) public var chatClient
> @Injected(\.utils) private var utils
>
> init() {}
>
> public func makeChannelListItem(
> channel: ChatChannel,
> channelName: String,
> avatar: UIImage,
> onlineIndicatorShown: Bool,
> disabled: Bool,
> selectedChannel: Binding<ChannelSelectionInfo?>,
> swipedChannelId: Binding<String?>,
> channelDestination: @escaping (ChannelSelectionInfo) -> CustomChannelDestination,
> onItemTap: @escaping (ChatChannel) -> Void,
> trailingSwipeRightButtonTapped: @escaping (ChatChannel) -> Void,
> trailingSwipeLeftButtonTapped: @escaping (ChatChannel) -> Void,
> leadingSwipeButtonTapped: @escaping (ChatChannel) -> Void
> ) -> some View { [Custom View]
> }
>
> func makeChannelDestination() -> (ChannelSelectionInfo) -> CustomChannelDestination {
> { selectionInfo in
> CustomChannelDestination(channel: selectionInfo.channel)
> }
> }
>
> struct CustomChannelDestination: View {
> var channel: ChatChannel
> var body: some View {
> VStack {
> Text("This is the channel \(channel.name ?? "")")
> }
> }
> } }