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
- Create a AddCommentRequest object using
AddCommentRequest.builder()
class by passing all the required parameters. - Call
addComment()
function using the instance ofLMFeedClient
. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
postId | String | ID of the post on which member has commented. | |
text | String | Text content of the comment. | |
tempId | String | Temporary ID for Comment |
AddCommentResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
comment | Comment | Object of the added comment. | |
users | [String: User] | Dictionary of user unique id to user object. |