Comment View
Overview
LMFeedCommentView is designed to display detailed information about a comment for a feed post.

Functionality
Protocols
LMFeedPostCommentProtocol
didTapUserName(for uuid: String): Handles the tap action on a user's name, passing the user's UUID.didTapCommentMenuButton(for commentId: String): Handles the tap action on a comment menu button, passing the comment ID.didTapLikeButton(for commentId: String, indexPath: IndexPath): Handles the tap action on a like button for a comment, passing the comment ID and the index path of the comment.didTapLikeCountButton(for commentId: String): Handles the tap action on a like count button for a comment, passing the comment ID.didTapReplyButton(for commentId: String): Handles the tap action on a reply button for a comment, passing the comment ID.didTapReplyCountButton(for commentId: String): Handles the tap action on a reply count button for a comment, passing the comment ID.didTapURL(url: URL): Handles the tap action on a URL, passing the URL.
UI Components
containerView: A LMFeedView serving as the main container for all other subviews.authorNameLabel: A LMFeedLabel used to display the name of the comment's author.commentStack: A LMFeedStackView that vertically aligns the comment and the see-more text button.commentContainerStack: A LMFeedStackView that horizontally aligns the comment stack and the menu button.commentLabel: A LMFeedTextView used to display the text of the comment.menuButton: A LMFeedButton used to present additional options related to the comment.actionStack: A LMFeedStackView that horizontally aligns action buttons like like, reply, and the separator view.likeButton: A LMFeedButton that lets users like the comment.likeTextButton: A LMFeedButton used to display the number of likes a comment has received.sepratorView: A LMFeedView used as a visual separator in the action stack.replyButton: A LMFeedButton that allows users to reply to the comment.replyCountButton: A LMFeedButton used to display the number of replies a comment has received.commentTimeLabel: A LMFeedLabel that shows when the comment was made.
Data Variables
delegate: A weak reference to an object conforming toLMFeedPostCommentProtocol, used for callback events.commentId: AStringcontaining the identifier for the comment.indexPath: AnIndexPathindicating the position of the comment in a list.likeCount: AnIntrepresenting the number of likes the comment has received.commentUserUUID: AStringcontaining the UUID of the user who made the comment.
Methods
configure(): Configures the view, setting up its content and appearance based on the model's data.
Action Handlers
didTapMenuButton(): Invoked when the menu button is tapped, informing the delegate to show additional options.didTapLikeButton(): Toggles the like state for the comment and updates the UI accordingly.didTapLikeCountButton(): Informs the delegate that the number of likes was tapped.didTapReplyButton(): Informs the delegate that the reply button was tapped, typically to initiate a reply action.didTapReplyCountButton(): Informs the delegate that the number of replies was tapped, usually to expand or view replies.didTapCommentUser(): Invoked when the author's name label is tapped, potentially navigating to the author's profile.
Customisation
CustomCommentView.swift
class CustomCommentView: LMFeedCommentView {
override func setupAppearance() {
super.setupAppearance()
backgroundColor = .green
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.commentView = CustomCommentView.self
// ...
return true
}