parse.com - Logical issue of how to get if the user has liked an image swift 2 -
i'm trying make simple photograph app tables in parse.com
table users
- id
- name
table follows
- id
- follower (pointer user)
- followed (pointer user)
table images
- id
- image (file)
- uploader (pointer user)
table likes
- id
- likedimage (pointer images)
- wholikedit (pointer user)
so have logic. if user1 likes image of user2 there row inserted in table likes. till now.
but if user1 closes app , opens again, show red heart (exactly in instagram) image cell if liked it.
the problem if query inside cellforitematindexpath
see if currentuser
, id of images matches somewhere @ table likes
not ux because if has 100 images slow, eventually.
so question is, there smart way make query , change image of cell instantly ???
i've thought when app opens (and user logged in) can make general query @ table likes , search currentuser id @ column wholikedit
, make array id's of images column likedimage
. inside
cellforitematindexpath
i can check if image's id inside array change liked image red heart, else leave is. way, going gain more speed in app ???
or can suggest other way?? lot time.
i suggest download user-related data on login , save locally. can access rendering ui. in specific case download id's of liked images , store in set
. can check, if liked 1 image in cellforitematindexpath
but aware, might need update local data @ point. push notifications useful in case
Comments
Post a Comment