Skip to main content

LMFeedTableView

Overview

The LMFeedTableView is a subclass of UITableView that provides additional utility methods for dynamic height calculation, loader management, and efficient reloading. It is designed for use in feed-style UIs with dynamic content.

File Location:
LMFeedTableView.swift

Functionality

UI Components

  • Inherits all properties and methods from UITableView
  • tableViewHeight: Returns the current content height of the table view

Methods

  • translatesAutoresizingMaskIntoConstraints() -> Self: Disables autoresizing mask translation and returns self for chaining
  • showHideFooterLoader(isShow:): Shows or hides a loading spinner in the table footer
  • reloadTable(for:): Reloads a specific row or section, or the entire table
  • reloadTableForSection(for:): Reloads a specific section or the entire table

Extensions

  • Methods for registering, dequeuing, and checking visibility of cells and headers

Customization

CustomFeedTableView.swift
class CustomFeedTableView: LMFeedTableView {
override init(frame: CGRect, style: UITableView.Style) {
super.init(frame: frame, style: style)
// Custom setup
}
required init?(coder: NSCoder) {
super.init(coder: coder)
// Custom setup
}
// Add customizations as needed
}
AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
LMUIComponents.shared.tableView = CustomFeedTableView.self
// ...
return true
}