xcode - Output of data with Firebase . Swift -
there gallery, in photo added, works through firebase. write data
@ibaction func savdata(_ sender: any) { let date1 = nsdate() let rootref = firdatabase.database().reference() rootref.child("/gellery/\(date1.description)/photo").setvalue(base64.convertimagetobase64(photoimage.image!)) rootref.child("/gellery/\(date1.description)/name").setvalue(addname?.text) let storyboard = uistoryboard(name: "main", bundle:nil) let vc = storyboard.instantiateviewcontroller(withidentifier: "nextview") as! navigationcontroller self.present(vc, animated: true, completion: nil) }
output of data
let rootref = firdatabase.database().reference() let imageref = rootref.child(constans.firebase.url.object) imageref.observe(.value, with: {(snapshot) in if let snapshots = snapshot.value as? [string: anyobject] { // let date = nsdate() snapshot in snapshots { if let dict = snapshot.value as? [string: anyobject] { let name = (dict["name"] as? string) ?? "" let photostring = (dict["photo"] as? string) ?? "" let aphoto = base64.convertbase64toimage(photostring) self.object1.append(item(photo: photostring, name: name)) //self.object1.removeall() } } } self.tableview.reloaddata() }) }
but photo @ output gallery table not displayed in order, not written in firebase. entry database date.
what ? how can sort date?
Comments
Post a Comment