Filter Firebase data Swift -


i want load every image of type modern on firebase swift. how can it?

here's data model:

"arts" : {     "-kw5plrmdfmga9pultg3" : {    "description" : "title ",    "height" : 25.36023,    "imageurl" : "https://firebasestorage.googleapis.com/v0/b/medici-b6f69.appspot.com/o/arts%2fj7u039fn6yckdbq7kgejkuzdo2i3%2f26ddc192-c081-4588-bd52-2841fa3ef507?alt=media&token=e828936c-5341-4429-94e9-c3aefa81769b",    "postdate" : 1478657252917,    "title" : "title ",    "type" : "modern",    "width" : 25.99424 } 

here's tried. it's not working.

database.child("arts").queryordered(bychild: "modern").observe(.value) { (snapshot: firdatasnapshot) in     self.posts = []      if let snapshot = snapshot.children.allobjects as? [firdatasnapshot] {         print("snapshot: \(snapshot)")          snap in snapshot {             if let postdict = snap.value as? dictionary<string, anyobject> {                 let key = snap.key                 let post = profileartmodel(key: key, artdata: postdict)                 self.posts.insert(post, at: 0)             }         }     }     self.tableview.reloaddata() } 

try:-

database.child("arts").queryordered(bychild: "type").queryequal(tovalue : "modern").observe(.value) { (snapshot: firdatasnapshot) in self.posts = []  if let snapshot = snapshot.children.allobjects as? [firdatasnapshot] {     print("snapshot: \(snapshot)")      snap in snapshot {         if let postdict = snap.value as? dictionary<string, anyobject> {             let key = snap.key             let post = profileartmodel(key: key, artdata: postdict)             self.posts.insert(post, at: 0)             self.tableview.reloaddata()         }     }   } } 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -