Here’s my code:
func loadData() {
ref.child(currentUserID!).observe(.childAdded) {
(snapshot) in
let snapshotValue = try? snapshot.value as? [String: AnyObject]
if let item = try TableViewModel(id: snapshot.key, likeLabel: self.likeLabel, playLabelString: self.playLabelString, json: snapshotValue) {
self.items.append(item)
}
self.tableViewModel = self.items.reversed() as [TableViewModel]
}
}
I can’t get my head around the following error:
Invalid conversion from throwing function of type
(_) throws -> ()to non-throwing function type(DataSnapshot) -> Void
in the following line:
ref.child(currentUserID!).observe(.childAdded) {
Please help.