Saturday, October 1, 2022
HomeiOS Developmentios - Learn how to parse JSON to the tableView in Swift?

ios – Learn how to parse JSON to the tableView in Swift?

Please give me advise, I cannot determine how one can parse information in a desk view correctly.

enter image description here

Right here is my mannequin:

struct ContinentRoot: Codable {
let hyperlinks: ContinentMiddle 

struct ContinentMiddle: Codable {
let continentItems: [ContinentsResponse]

struct ContinentsResponse: Codable {
let identify: String
let href: String

In ViewController I add tableView, continentsArray ([ContinentRoot]) and do some common issues for networking.
I suppose that the issue could also be right here, as a result of within the networking methodology every thing appears regular:

func tableView(_ tableView: UITableView, numberOfRowsInSection part: Int) -> Int {
    return continentsArray.rely

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "ContinentsTableViewController", for: indexPath)
    let mannequin = continentsArray[indexPath.row].hyperlinks.continentItems[indexPath.row].identify
    cell.textLabel?.textual content = mannequin
    return cell

Thanks a lot for for consideration!



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments