Text Cell
Overview
LMFeedPostTextCell is a subclass of LMPostWidgetTableViewCell designed to display text-based posts in the LikeMinds Feed module. This cell is responsible for presenting the post’s title and body text. It includes a "See More" button that appears when the content exceeds a certain length. The layout is managed using Auto Layout to ensure proper arrangement and sizing of subviews according to the content.

File Location:
LMFeedPostTextCell.swift
Functionality
Protocols
LMFeedPostTextCellDelegate
Conforms to LMPostWidgetTableViewCellDelegate. It includes functions for handling interactions within the text cell:
didTapPost(postID: String): Invoked when the user taps on the post content.didTapURL(url: URL): Called when a URL in the text is tapped.didTapRoute(route: String): Called when a route in the text is tapped.didTapSeeMoreButton(for postID: String): Called when the "See More" button is tapped.
UI Components
questionTitle: An LMFeedLabel displaying the title of the post.postText: An LMFeedTextView that shows the body text of the post. It supports rich text attributes and handles user interactions such as tapping on URLs or hashtags.seeMoreButton: An LMFeedButton that shows additional content when the post text exceeds a certain length.
Data Variables
actionDelegate: A weak reference to an instance conforming toLMFeedPostTextCellDelegatefor handling user interactions.postID: An optionalStringthat stores the identifier of the post.
Methods
configure(data: LMFeedPostContentModel): Configures the cell with the provided post data. Sets the title, body text, and configures the visibility of the "See More" button based on the content length.tappedTextView(tapGesture: UITapGestureRecognizer): Handles taps on the text view. Determines if a URL, hashtag, route, or post content was tapped and notifies the delegate accordingly.didTapURL(url: URL): Called when a URL is tapped in the text view.didTapHashTag(hashtag: String): Placeholder for handling hashtag taps (currently does nothing).didTapRoute(route: String): Called when a route is tapped in the text view.didTapSeeMoreButton(): Called when the "See More" button is tapped. Notifies the delegate to handle the event.
Action Handlers
didTapSeeMoreButton(): The selector method for the "See More" button's tap action. It checks if thepostIDis set and notifies the delegate to handle the event.
Customisation
CustomTextCell.swift
class CustomTextCell: LMFeedPostTextCell {
override func setupAppearance() {
super.setupAppearance()
contentView.backgroundColor = .lightGray
questionTitle.font = UIFont.boldSystemFont(ofSize: 18)
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.textCell = CustomTextCell.self
// ...
return true
}