I am trying to fetch data from php file in json to my tableview in swift 5 I am able to get the data in the console as json array, what I want is to fetch the data into my custom cell but I am not getting the json data array keys for example data["user_id"] it is not loading anything
func getUsers() {
AF.request(SiteUrl).validate().responseJSON { response in
switch response.result {
case .success:
print("Validation Successful)")
if let json = response.data {
do{
let data = try JSON(data: json)
let str = data
print("DATA PARSED: (str)")
}
catch{
print("JSON Error")
}
}
case .failure(let error):
print(error)
}
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return data.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let customCell = tableView.dequeueReusableCell(withIdentifier: TableViewCell.identifier, for: indexPath) as! TableViewCell
let cell = tableView.dequeueReusableCell(withIdentifier: "myCell", for: indexPath)
cell.textLabel?.text = "Hi Hadi"
//customCell.AdTitle.text =
return customCell
}