Unable to fetch information from API.
class GetData{
static let sharedInstance = GetData()
func callingGetAPI() {
let url = "https://jsonplaceholder.typicode.com/posts"
AF.request(url, technique: .get, parameters: nil, encoder: JSONParameterEncoder.default, headers: nil,interceptor: nil).response{
responce in
debugPrint(responce)
swap responce.outcome{
case .success(let information):
do{
let json = attempt JSONDecoder().decode([Model].self, from: information!)
print(json)
}catch{
print( "Please Strive once more")
// completionHandler(.failure(.customized(message: "Please Strive once more")))
}
case .failure(let err):
print(err.localizedDescription)
print( "Please Strive once more")
}
}
}
}
struct Mannequin:Codable {
let userId:Int
let id:Int
let title : String
let physique: String
}