Skip to content

Instantly share code, notes, and snippets.

@3257
Created April 8, 2018 16:34
Show Gist options
  • Save 3257/e8080459d951a1be7c8080be95f94f85 to your computer and use it in GitHub Desktop.
Save 3257/e8080459d951a1be7c8080be95f94f85 to your computer and use it in GitHub Desktop.
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
ref.child("unicorns").observe(.value) { snapshot in
var unicorns = [Unicorn]()
for unicornSnapshot in snapshot.children {
let unicorn = Unicorn(snapshot: unicornSnapshot as! DataSnapshot)
unicorns.append(unicorn)
}
self.unicorns = unicorns
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment