Skip to main content

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.

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 of LMChatHomeFeedShimmerView used as a loading indicator.
  • noResultFoundView: An instance of LMChatNoResultView displayed 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 of LMChatHomeFeedChatroomCell.ContentModel objects.
  • delegate: A weak reference to an object conforming to LMHomFeedListViewDelegate.
  • tableSections: An array of ContentModel objects 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
}