Skip to main content

Add Comment

The LikeMinds iOS Feed SDK, users can engage in interactive discussions by adding comments to posts. This powerful feature enables users to express their thoughts, ask questions, and engage with other members in a dynamic and collaborative manner. By integrating the comment functionality, developers can foster meaningful conversations and enhance the overall user experience within their application.

Steps to add a comment on post

  1. Create a AddCommentRequest object using AddCommentRequest.builder() class by passing all the required parameters.
  2. Call addComment() function using the instance of LMFeedClient.
  3. Process the response LMResponse<AddCommentResponse> as per your requirement.
// object of AddCommentRequest
let request = AddCommentRequest.builder()
.postId(ENTER_POST_ID) // id of the post on which member has commented
.text("comment text") // comment text
.tempId(ENTER_TEMP_ID)
.build()
LMFeedClient.shared.addComment(request) { response in
// response (LMResponse<AddCommentResponse>)
if (response.success) {
// your function to process the response data
processResponse(response.data)
} else {
// your function to process error message
processError(response.errorMessage)
}
}

Additional Features

Tag a User

To tag a user, use the getTaggingList() function to fetch the list of users that can be tagged, and use the format <<[user.name]|route://user_profile/[user.sdkClientInfo.uuid]>> to embed it inside the text of the comment.

Models

AddCommentRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
postIdStringID of the post on which member has commented.
textStringText content of the comment.
tempIdStringTemporary ID for Comment

AddCommentResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
commentCommentObject of the added comment.
users[String: User]Dictionary of user unique id to user object.