API GET POST WITH ALAMOFIRE

 func PostMethod()
    {
       
       let paramsSignin = [ "email":"abc@gmail.com" as AnyObject,
                           "password": "123456" as AnyObject,
                           "login_type": "\(0)" as AnyObject]
        
      let  paramsSignup = [ "email":"abc@gmail.com" as AnyObject,
                               "password": "123456" as AnyObject,
                               "dob": "05/05/1236" as AnyObject,
                               "login_type": "\(0)" as AnyObject,
                               "username": "" as AnyObject,
                               "mobileno": "" as AnyObject,
                               "gender": "" as AnyObject]
        
        print(paramsSignin)
        
        let urlPath : String = "url"
        
        let req = request(urlPath, method: .post, parameters: paramsSignin, encoding:URLEncoding.default  , headers: nil)
        
        req.responseJSON { (response) in
            if response.result.isFailure{
                print("fail")
            }
            if response.result.isSuccess{
                if let json = response.result.value as? NSDictionary
                {
                    print(json)
                }
            }
        }

    }

Comments