Last active
May 4, 2016 22:08
-
-
Save tobeiosdev/1ac87bfd4ed0bd33d35e21dd7b810c6e to your computer and use it in GitHub Desktop.
This file contains 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
var testArray = [String]() | |
var initialLoad = true | |
override func viewDidLoad() { | |
DataService.ds.REF_TITLE.queryOrderedByChild("timestamp").observeEventType(.ChildAdded, withBlock: { snapshot in | |
let lastName = snapshot.key as String | |
print(snapshot.key) | |
self.testArray.insert(lastName, atIndex: 0) | |
self.countTitle.text = "\(self.testArray.count) posts" | |
}) | |
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