I to be trying to connect my API data to watch it in the cell but it seems that i can’t obtain my solution and it’s always == nilThe code listed below describes the Country.SWIFT // Model.SWIFT // Response.SWIFT i beg your pardon is reflecting how can I acquire my JSON solution using Codableand CountryCell.SWIFT is showing exactly how I used it to speak to the APIThe link to the API image:



struct Country: Decodable var CountryName = "" var CountryImage = "" var objectId = ""https:// MARK: - Coding Keysenum CodingKeys: String, CodingKey situation CountryName = "CountryName" situation CountryImage = "CountryImage" case objectId = "objectId"//MARK: - Json Decoderinit(from decoder: Decoder) litter let container = shot decoder.container(keyedBy: CodingKeys.self) // Parsing our qualities self.CountryName = try container.decode(String.self, forKey: .CountryName) self.CountryImage = shot container.decode(String.self, forKey: .CountryImage) self.objectId = try container.decode(String.self, forKey: .objectId)>Model.SWIFT

protocol ModelDelegate func countriesFetched (_ countries: ) class version //MARK: - Vars var delegate: ModelDelegate? // MARK: - Get nations func getCountries () // URL thing let url = URL(string: Constants.API_URL) guard url != nil rather return // URL Session object let conference = URLSession.shared //Data job from URLSession object let dataTask = session.dataTask(with: url!) // begin data job dataTask.resume() Response.SWIFT

struct Response: Decodable var items: ? = <> init(from decoder: Decoder) throws var itemsContrainer = try decoder.unkeyedContainer() self.items = try itemsContrainer.decode(.self) CountryCell.SWIFT

class CountryCell: UICollectionViewCell //MARK: - Vars var country: Country? //MARK: - Outlets
IBOutlet weak var lblCountryNameOutlet: UILabel! //MARK: - creating Cell func generateCell (_ myCountry: Country) self.country = myCountry guard self.country != nil else return lblCountryNameOutlet.text = country!.CountryName guard self.country!.CountryImage != "" rather return allow url = URL(string: self.country!.CountryImage) guard url != nil rather return let conference = URLSession.shared permit dataTask = session.dataTask(with: url!) dataTask.resume()