Created
June 23, 2017 23:25
-
-
Save ts95/697cbfa4dc2903702442e5dad32051a2 to your computer and use it in GitHub Desktop.
Example of fetching a book by its id and printing out the title of it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let db = FIRDatabase.database() | |
let bookRef = db.reference(withPath: Endpoint.book("-KnEUaDbm6-snUq_Ojzo").path) | |
bookRef.observeSingleEvent(of: .value, with: { snapshot in | |
guard let book = Book(snapshot: snapshot) else { return } | |
print(book.title) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment