I'm need to add new 'Like' feature to existing Social Network iOS app. The user can do 'Like' action on comments of other users.
1) If the the user hits 'Like' the comment will be marked as 'Liked' by the user. 2) I need to display the 'Likes' count in the comment view. 3) If the user hits the count of the 'Likes' he can see the list of the users that did 'Like'.
My approach was to add new table to the ParseDB called 'like' with columns - ' commentID, userID. When the comment will be display, I'll make a query to the 'like' table and fetch the users that 'liked' the comment.
Is it the correct approach or this will be cause IO delays in the UI? please give answer if you have experience with ParseDB only.
IMO solution in OP will work but you might want to consider two additional options.
In order to minimize metered query costs consider 'likes-ctr' column on 'comments. Like button cliks ++ this.
To flaten the query that join users to comments which they liked consider Array type colum. On 'comments' that hols pointer to user. APIs have ' addUniq' which nicely handle updating an array with poiter to user as long as u have ref to currentUset object.
Query.include('usersLiked')
Added will do the he join work