Skip to content

Instantly share code, notes, and snippets.

@tobeiosdev
Created May 4, 2016 20:51
Show Gist options
  • Save tobeiosdev/44eb57e7fc7ccc182900f67d8cef0b95 to your computer and use it in GitHub Desktop.
Save tobeiosdev/44eb57e7fc7ccc182900f67d8cef0b95 to your computer and use it in GitHub Desktop.
var testArray = [String]()
var initialLoad = true
override func viewDidLoad() {
DataService.ds.REF_TITLE.observeEventType(.ChildAdded, withBlock: { snapshot in
let lastName = snapshot.key as String
self.testArray.insert(lastName, atIndex: 0)
})
DataService.ds.REF_TITLE.observeSingleEventOfType(.Value, withBlock: { snapshot in
if self.initialLoad == true {
self.tableView.reloadData()
self.initialLoad = false
}
})
}
@IBAction func refreshBtn_clicked(sender: AnyObject) {
tableView.setContentOffset(CGPointZero, animated: true)
self.tableView.reloadData()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment