Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var items = [ItemViewController.Item]()
- Database.database().reference(withPath: "items").observe(.childAdded, with: { snapshot in
- var newItems: [ItemViewController.Item] = []
- for child in snapshot.children { // children of "items"
- if let snapshot = child as? DataSnapshot,
- let item = ItemViewController.Item(snapshot: snapshot) {
- //print(item)
- newItems.append(item)
- //print(item.key)
- }
- }
- self.items = newItems
- print(self.items)
- self.tableView.reloadData()
- })
- }
- self.name = name
- self.key = snapshot.key
- //print("snapshot.key = (snapshot.key)")
- self.surname = surname
- self.age = age
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement