Home Feed List View
Overview
The LMChatHomeFeedListView is a customizable view component that displays a list of chat rooms and an explore tab in a table format. It's designed to show a home feed for a chat application, supporting different sections and cell types.
File Location:
LMChatHomeFeedListView.swift
Functionality
Protocols
LMHomeFeedListViewDelegate
Defines methods for handling user interactions and pagination:
didTapOnCell(indexPath: IndexPath): Called when a cell is tapped.fetchMoreData(): Called when more data needs to be loaded.scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool): Called when the scroll view ends dragging.scrollViewDidScroll(_ scrollView: UIScrollView): Called when the scroll view is scrolled.
UI Components
containerView: A LMView that serves as the main container.loadingView: An instance ofLMChatHomeFeedShimmerViewused as a loading indicator.noResultFoundView: An instance ofLMChatNoResultViewdisplayed when no results are found.tableView: A LMTableView that displays the list of chat rooms and explore tab.
Data Variables
cellHeight: A constant CGFloat value representing the height of each cell (60).data: An array ofLMChatHomeFeedChatroomCell.ContentModelobjects.delegate: A weak reference to an object conforming toLMHomFeedListViewDelegate.tableSections: An array ofContentModelobjects representing different sections.
Methods
reloadData(): Sorts the table sections and reloads the table view.updateChatroomsData(chatroomData:): Updates the chatrooms data in the table sections.updateExploreTabCount(exploreTabCount:): Updates the explore tab data in the table sections.
Customization
CustomHomeFeedListView.swift
class CustomHomeFeedListView: LMChatHomeFeedListView {
override func setupAppearance() {
super.setupAppearance()
containerView.backgroundColor = .lightGray
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.homeFeedListView = CustomHomeFeedListView.self
// ...
return true
}