Tuesday, April 21, 2026
HomeiOS Developmentios - How one can parse JSON to the tableView in Swift?

ios – How one can parse JSON to the tableView in Swift?

[ad_1]

Please give me advise, I cannot work out the best way to parse knowledge 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 technique every thing appears regular:

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

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!

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments