retrieving the data from firebase database and manipulate it in swift -
it's been while have started working firebase database. here code :
let fbref = firebase(url: "https://mylogin-fb.firebaseio.com") var gatherdata = fbref.observeeventtype(.childadded, withblock: { snapshit in print(snapshit.value) }, withcancelblock: { error in print(error.description) })
and here results :
{ "detail " = swift; "title " = programming; }
how can "swift" or "programming" ????
use objectforkey retrieve data.
in case :
let title = snapshot.value.objectforkey("title") let detail = snapshot.value.objectforkey("detail") print("title : \(title), detail : \(detail)")
Comments
Post a Comment