From Stream SwiftUI document on customising channel list item, it stated that we will be able to change the custom UI by calling function makeChannelListItem in viewFactory and replace the return view by custom view class.
But the app is still calling the default function instead of my custom function, which makes me cannot update the UI.
Here is the implementation of the function
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 {
Text("Custom List Item")
}
Anyone know why the function cannot be override?
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.
The main point here is to init ViewFactory ChannelDestination.
Whole Code: