I have created one class name Users as below
public class Users: NSObject {
var name: String?
var email: String?
}
and other class create array of user class
var regUser = [Users]()
and
func fetchUser(){
Database.database().reference().child("users").observe(.childAdded, with: {(DataSnapshot) in
if let dictionary = DataSnapshot.value as? [String: AnyObject]{
let user = Users()
user.setValuesForKeys(dictionary)
self.users.append(user)
DispatchQueue.main.async {
self.tableView.reloadData()
}
print(user.email)
}
}, withCancel: nil)
}
The following error occurs:
"Users 0x60400028fdc0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key name."