Reply View
Overview
LMFeedReplyView is crafted to showcase individual reply within the context of a feed post comment, providing a structured and interactive representation of user comments' reply.
File Location:
LMFeedReplyView.swift
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
viewModel: An instance ofLMFeedPostDetailCommentCellViewModelused for configuring the cell with specific comment data, including content, commenter information, and interaction counts.delegate: A weak reference to an object conforming toLMFeedPostCommentProtocol, which is notified about interaction events within the cell.
Methods
configure(): Configures the view, setting up its content and appearance based on the model's data.
Action Handlers
didTapProfileImage(): Invoked when the commenter's profile image is tapped. This action informs the delegate to potentially navigate to the commenter's profile.didTapLikeButton(): Toggles the like state for the comment, updates the UI to reflect this change, and informs the delegate about the like interaction.didTapReplyButton(): Signals the delegate when the reply button is tapped, indicating that the user wishes to reply to the comment.
Customisation
CustomReplyView.swift
class CustomReplyView: LMFeedReplyView {
override func setupAppearance() {
super.setupAppearance()
backgroundColor = .green
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.replyView = CustomReplyView.self
// ...
return true
}