Getting a list from Firebase

To get a list of data, say blog posts, you need to access the database.

  1. set database reference
  2. check for data existence
  3. remove existing data from local array
  4. cast snapshot data objects as an array of snapshots
  5. for each snapshot, cast snapshot as a [String: AnyObject] Dictionary
  6. assign Content from the snapshot to variables
  7. Create an object from the data model with pulled data
  8. append new object to local data array

Sorting can take place after all data is grabbed

If using a table, reload the table data here using tableView.reloadData()

Screen Shot 2017-05-24 at 9.45.03 PM.png

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s