When I fetch data through a GET method in Swift it is presented as an Array:
URLSession.shared.dataTask(with: request as URLRequest) { (data, response, error) in
guard let data = data else { return }
do {
let obj: Response = try JSONDecoder().decode(Response.self, from: data)
let cit = obj.assetProfile?.city
let coun = obj.assetProfile?.country
let negociosLocacion = ("\(cit ?? "N/A"), \(coun ?? "N/A")")
let object = EObject(marketOpen: (obj.price?.regularMarketOpen?.fmt ?? "N/A"))
self.e.append(object)
But how do I create a catch method where if the index is out of range will present a segue, for example, as to not crash the app?