Hey guys, I'm having a problem when attempting to display data from an API JSON feed in a tableview. While some of my functions are strings, others are double or int. Therefore, I get the error "Cannot assign value of type 'Double?' to type 'String?'" when attempting to display data in a double format. Also, it should be noted that this JSON feed has nested elements. How can I go about fixing this issue. For reference, the needed parts of my code are below.
JSON Struct
struct PlayerStatsParent:Decodable{
let rankings: [PlayerStats]
}
struct PlayerStats:Decodable {
let personaname: String?
let score: Double?
let solo_competitive_rank: Int?
let avatar: String?
}Tableview Cell Function
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "rankCell") as? RankTableViewCell else { return UITableViewCell() }
cell.nameLabel.text = rank[indexPath.row].score
}