Monday, October 23, 2023
HomeiOS DevelopmentGeneric parameter 'Parameters' couldn't be inferred

Generic parameter ‘Parameters’ couldn’t be inferred


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
 }



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments