Skip to content

Instantly share code, notes, and snippets.

@phucnm
Created August 11, 2017 09:17
Show Gist options
  • Select an option

  • Save phucnm/1deb4c5df2c01eddca2d72adc8cc881b to your computer and use it in GitHub Desktop.

Select an option

Save phucnm/1deb4c5df2c01eddca2d72adc8cc881b to your computer and use it in GitHub Desktop.
func getPost(postId: String, completion:@escaping ((Post?) -> Void)) {
let postRef = Database.database()
.reference().child("posts").child("postId")
postRef.observeSingleEvent(of: .value, with: { (snapshot) in
completion(Post(snapshot: snapshot))
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment