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
  • email

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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -