Guest User

Untitled

a guest
May 28th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. for child in snapshot.children {
  2. let bus = Bus()
  3. let snap = child as! DataSnapshot
  4. let key = snap.key
  5.  
  6. if let coming = snap.childSnapshot(forPath: "coming").value as? Bool {
  7. bus.coming = coming
  8. }
  9.  
  10. if let gone = snap.childSnapshot(forPath: "gone").value as? Bool {
  11. bus.gone = gone
  12. }
  13.  
  14. if let here = snap.childSnapshot(forPath: "here").value as? Bool {
  15. bus.here = here
  16. }
  17.  
  18. if let location = snap.childSnapshot(forPath: "location").value as? String {
  19. bus.location = location
  20. }
  21.  
  22. if let notes = snap.childSnapshot(forPath: "notes").value as? String {
  23. bus.notes = notes
  24. }
  25.  
  26. busArray.append(bus)
  27.  
  28. class Bus: NSObject {
  29. var here: Bool
  30. var gone: Bool
  31. var coming: Bool
  32. var location: String
  33. var notes: String?
  34.  
  35. override init() {
  36. self.here = false
  37. self.gone = false
  38. self.coming = true
  39. self.location = ""
  40. self.notes = ""
  41. }
Add Comment
Please, Sign In to add comment