swift3 - How to compare different values in firebase? -


i have 2 models, user , post , function observing posts. need send post on user feed, comparing data, example:

if user.location == post.location &  user.interest == post.interest {print("post.id")} 

models:

class user { var name: string? var location: string? var interest: string? }  class post {     var name: string?     var location: string?     var interest: string?     } 

function:

func loadposts() {              self.tableview.reloaddata()             //        self.activityindicatorview.startanimating()             api.feed.observefeed(withid: api.user.current_user!.uid) { (post) in                 guard let postid = post.uid else {                     return                 }                  self.fetchuser(uid: postid, completed: {                     self.posts.insert(post, at: 0)                     self.activityindicatorview.stopanimating()                     self.tableview.reloaddata()                  })             }         } 


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -