Skip to content

Instantly share code, notes, and snippets.

@Prasad9
Prasad9 / Listener.swift
Last active August 21, 2016 12:15
Swift code for listening to nodes in Firebase
let questionListenerFirebaseRef = FIRDatabase.database().reference().child(<your_channel_name>)
questionListenerFirebaseRef.observeEventType(FIRDataEventType.ChildAdded) { (dataSnapshot: FIRDataSnapshot) in
// Question added. Proceed accordingly.
}
@Prasad9
Prasad9 / upload.swift
Created August 21, 2016 12:00
Code for storing data in Firebase
let uploadQuestionFirebaseRef = FIRDatabase.database().reference().child(<your_channel_name>)
uploadQuestionFirebaseRef.setValue(<upload_data>)