Skip to main content

Post Detail

Overview

In the Post Detail screen, the LikeMinds Feed SDK reuses the LMFeedPostMediaCell, LMFeedPostLinkCell, and LMFeedPostDocumentCell components from the Post List screen. While these cells share a similar UI, separate classes have been created for each to allow customization and extensibility.

LMFeedPostDetailScreen

Protocols Implemented

UI Components

  • postDetailListView: A LMTableView used to display the post's details, media, comments, and replies.
    • Registered Cells: LMFeedPostDetailMediaCell, LMFeedPostDetailDocumentCell, LMFeedPostDetailLinkCell
    • Registered Header: LMFeedPostDetailHeaderView
    • Registered Footer: LMFeedPostDetailFooterView
  • refreshControl: A UIRefreshControl allowing users to refresh the post details and comments.
  • containerView: A LMView that contains the input elements for adding a new comment.
  • containerStackView: A LMStackView that organizes the tagging view, reply separator, reply view, and the input stack view vertically.
  • taggingView: A custom view for displaying tagged users.
  • replyView: A LMView containing elements to show the current reply context.
  • replyNameLabel: A LMLabel displaying the name of the user being replied to.
  • removeReplyButton: A button for dismissing the current reply context.
  • stackView: A horizontal LMStackView containing the input text view and the send button.
  • inputTextView: A custom text view for entering comments. This is used for handling mentioning users.
  • sendButton: A LMButton for submitting the entered comment.
  • replySepratorView: A view used as a separator line between the tagging view and the reply view.

Data Variables

  • postData: Stores the post data conforming to LMFeedPostTableCellProtocol.
  • commentsData: An array of LMFeedCommentContentModel representing the comments and replies data.
  • isCommentingEnabled: A Boolean indicating whether commenting is enabled for the current user.

Customisation

CustomPostDetailScreen.swift
class CustomPostDetailScreen: LMFeedPostDetailScreen {
override func setupAppearance() {
super.setupAppearance()
tableView.backgroundColor = .lightGray
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
Components.shared.postDetailScreen = CustomPostDetailScreen.self
// ...
return true
}