Skip to content

Instantly share code, notes, and snippets.

@3257
Created April 7, 2018 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3257/fec0331a9c81b1d3109f297f816e7c76 to your computer and use it in GitHub Desktop.
Save 3257/fec0331a9c81b1d3109f297f816e7c76 to your computer and use it in GitHub Desktop.
fileprivate func writeUnicornToDatabase(_ unicorn: Unicorn) {
// Access the "unicorns" child reference and then access (create) a unique child reference within it and finally set its value
ref.child("unicorns").child(unicorn.seenAt + "\(Int(Date.timeIntervalSinceReferenceDate * 1000))").setValue(unicorn.toAnyObject())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment