Skip to content

Instantly share code, notes, and snippets.

@ts95
Last active October 4, 2017 18:48
Show Gist options
  • Save ts95/d05d2551d800b5b2bb3cd67bb905772c to your computer and use it in GitHub Desktop.
Save ts95/d05d2551d800b5b2bb3cd67bb905772c to your computer and use it in GitHub Desktop.
let book = FirestoreBook(
isbn: "95-0443-843-0",
title: "Do Androids Dream of Electric Sheep?",
authors: ["Philip K. Dick"],
year: 1968,
country: "United States",
createdAt: Date(),
format: .ebook,
award: nil)
let firestore = Firestore.firestore()
let ref = firestore.collection("books").document(book.documentID)
ref.setModel(book) // as opposed to using .setData([:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment