OK
Size: a a a
OK
KK
ВК
OK
KK
ВК
KK
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
reff?.observe(.value, with: {[weak self] (snapshot) in
var _rooms = Array<Rooms>()
for item in snapshot.children {
let rooms = Rooms(snapshot: item as! DataSnapshot)
_rooms.append(rooms)
}
self?.rooms = _rooms
NotificationCenter.default.post(name: Notification.Name("Rooms"), object: self?.rooms)
self?.tableView.reloadData()
})
}
override func viewDidLoad() {
super.viewDidLoad()
guard let currentUser = Auth.auth().currentUser else {return}
user = Users(user: currentUser )
ref = Database.database().reference(withPath: "users").child(String(user.uid)).child("rooms")
NotificationCenter.default.addObserver(self, selector: #selector(notificationFired(_:)), name: Notification.Name("Rooms"), object: nil)
//создали уведомление
}
ДБ
DM
ВК
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
reff?.observe(.value, with: {[weak self] (snapshot) in
var _rooms = Array<Rooms>()
for item in snapshot.children {
let rooms = Rooms(snapshot: item as! DataSnapshot)
_rooms.append(rooms)
}
self?.rooms = _rooms
NotificationCenter.default.post(name: Notification.Name("Rooms"), object: self?.rooms)
self?.tableView.reloadData()
})
}
override func viewDidLoad() {
super.viewDidLoad()
guard let currentUser = Auth.auth().currentUser else {return}
user = Users(user: currentUser )
ref = Database.database().reference(withPath: "users").child(String(user.uid)).child("rooms")
NotificationCenter.default.addObserver(self, selector: #selector(notificationFired(_:)), name: Notification.Name("Rooms"), object: nil)
//создали уведомление
}