Document Cell
Overview
LMFeedPostDocumentCell is a subclass of LMPostWidgetTableViewCell designed to display posts with document attachments in a feed.

File Location:
LMFeedPostDocumentCell.swift
Functionality
Protocols
LMFeedPostDocumentCellProtocol
Conforms to LMPostWidgetTableViewCellProtocol. It includes functions for handling interactions within the document cell:
didTapShowMoreDocuments(for indexPath: IndexPath): Invoked when the user taps the "See More" button to view additional documents.didTapDocument(with url: URL): Called when a document preview is tapped.
UI Components
documentContainerStack: An LMFeedStackView used to vertically stack document preview views.seeMoreDocumentsButton: An LMFeedButton for showing more documents if they exceed the predefined limit.
Data Variables
delegate: A weak reference to an instance conforming toLMFeedPostDocumentCellProtocolfor handling user interactions.indexPath: Optionally stores theIndexPathof the cell within the tableView, useful for delegate callbacks.
Methods
configure(): Configures the cell with the data and sets the delegate. It prepares the document previews and sets the post Text accordingly.
Action Handlers
didTapSeeMoreDocuments(): The selector method for the "See More" button's tap action. It checks if theindexPathis set and notifies the delegate to handle the event.
Customisation
CustomDocumentCell.swift
class CustomDocumentCell: LMFeedPostDocumentCell {
override func setupAppearance() {
super.setupAppearance()
containerView.backgroundColor = .green
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.documentCell = CustomDocumentCell.self
// ...
return true
}